Direct upload URL not working with Dart

I am trying to upload an image to images from Flutter and is loading everything, but at the end gives me 400 error:

My code:

flutter: {“result”:{“id”:“920f707a-4bf6-41b1-929b-01e0b5884e00”,“uploadURL”:“https:///”},“result_info”:null,“success”:true,“errors”:,“messages”:}

The query for the one time upload URL looks like this:
Looks correct according to the docs

final result = await requestDirectUploadLink();
var url =[‘result’][‘uploadURL’];
var imageId =[‘result’][‘id’];
var form = FormData.fromMap({
‘image’: await MultipartFile.fromFile(imagePath),
try {
final response =,
data: form, onSendProgress: progress, options: uploadAuth);
} on Exception catch (_, e) {
debugPrint(‘Exception Cloudflare $e’);

url is the one time upload URL fetched from the server.

Curiuosly it shows me the whole progress but at the end gives me a 400 error…
flutter: DioError [DioErrorType.response]: Http status error [400]
Source stack:
#0 DioMixin.fetch (package:dio/src/dio_mixin.dart:488:35)
#1 DioMixin.request (package:dio/src/dio_mixin.dart:483:12)
#2 (package:dio/src/dio_mixin.dart:97:12)
#3 CloudflareApi.uploadImage (package:petme/cloudfare/api.dart:52:28)

This topic was automatically closed after 15 days. New replies are no longer allowed.