Upload file is not working

I am using the same command to upload an Image to Backendless but I get this error and the app terminated.

Unsupported value: <Backendless.BackendlessFile: 0x282f1e3e0> of type Backendless.BackendlessFile
*** Assertion failure in -[backendless_sdk.BackendlessWtiter writeValue:], FlutterStandardCodec.mm:334
*** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Unsupported value for standard codec’
*** First throw call stack:
(0x18489204c 0x19cf06f54 0x18614b6cc 0x10975c138 0x106e62850 0x106e62920 0x10975c7c0 0x109759890 0x106eab6d0 0x106e8addc 0x1069ccd94 0x10695c6e0 0x10695c7f0 0x185034b34 0x185045af8 0x184502914 0x184504660 0x184512b60 0x18484acd4 0x184804eac 0x1848183b8 0x1a01a838c 0x1871b86a8 0x186f377f4 0x104f6b984 0x106399a24)
libc++abi: terminating with uncaught exception of type NSException

  • thread #1, queue = ‘com.apple.main-thread’, stop reason = signal SIGABRT
    frame #0: 0x00000001babd4964 libsystem_kernel.dylib__pthread_kill + 8 libsystem_kernel.dylib__pthread_kill:
    → 0x1babd4964 <+8>: b.lo 0x1babd4984 ; <+40>
    0x1babd4968 <+12>: pacibsp
    0x1babd496c <+16>: stp x29, x30, [sp, #-0x10]!
    0x1babd4970 <+20>: mov x29, sp
    Target 0: (Runner) stopped.
    Lost connection to device.

My codes in Flutter are these:

Uint8List file = await imageFile.readAsBytes();
await Backendless.files.saveFile(file, filePathName: ‘/StoreFiles/$ownerId/${imageFile.path.split(’/’).last}’).then((response) {
fileName = response.toString();

}).onError((error, stackTrace){
  print('savefile error: $error');

nd when I want to just simply upload it it says:

[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: PlatformException(6002, Unable to write bytes into file /opt/backendless/repo/f16241ba-7a18-f7d0-ff2f-3f9e30c90900/files/StoreFiles/C69992E1-8298-49B3-AFF8-12515841899D, Unable to write bytes into file /opt/backendless/repo/f16241ba-7a18-f7d0-ff2f-3f9e30c90900/files/StoreFiles/C69992E1-8298-49B3-AFF8-12515841899D, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)

#2 UploadImageToBackend.uploadImageToBackendless (package:retailers/data/upload_image/upload_image.dart:17:5)

#3 _ShowImageWidgetState.build. (package:retailers/ui/view_select_image/show_image_widget.dart:73:17)

Hello, @Ehsan_Nikaeen1.
Thank you for reporting this issue. Bug was fixed in backendless_sdk for Flutter 7.2.2 version. You need to update your dependency. Then you can try run your code again.
Please let us to know if everything works as expected.

Best Regards, Nikita.

The problem of uploading is solved but the command is not working fine.
If the command is something like this, it should save the file in the /StoreFiles/$ownerId/ directory, Not saves it in /StoreFiles/ directory with $ownerId name.

like this:

await Backendless.files.upload(imageFile, '/StoreFiles/$ownerId/', overwrite: true).then((response) {
      newFileName = response.toString();


Hi, @Ehsan_Nikaeen1

I was not able to reproduce your issue. It looks like you missed a filename in the route. Your route should look like this:

/files/path/file name

Please, take a look at this documentation to find more

File Upload - Backendless SDK for Flutter API Documentation

Regards, Marina