Back

How to use onProgress !

  • 0
  • Flutter
Wiseman
8 Feb, 2024, 20:58

'''onProgress: (UploadProgress progress) { print(progress.toString() +"Progress"); }, );'''

TL;DR
Title: How to correctly use onProgress in storage.createFile() Message: It is not recommended to use `toString()` for objects in the onProgress function. Instead, access the fields individually. Instead of: print(progress.toString() +"Progress"); Use: print(progress.fieldName + "Progress"); This will ensure the correct serialization of objects.
Wiseman
8 Feb, 2024, 20:59

storage.createFile( bucketId: 'bucketid', fileId: ID.unique(), file: InputFile.fromPath(path: filePath, filename: fileName), onProgress: (UploadProgress progress) { print(progress.toString() +"Progress"); }, );

Steven
8 Feb, 2024, 20:59

don't use progress.toString(). access the fields individually

Steven
8 Feb, 2024, 20:59

it's usually a bad idea to do toString() because objects may not serialize to string like you expect

Wiseman
8 Feb, 2024, 20:59

ok

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more