Report this

What is the reason for this report?

How to get progress informations when uploading files with Flutter

Posted on March 30, 2021

I’m trying to use Digital Ocean Spaces as file storage for my Flutter application. As API helper I’m using the package minio (https://pub.dev/packages/minio).

In general I can start upload and download operations. But I can’t find a way to get progress informations.

I tried to set a bucket event like this:

void bucketListener() {
    // Listener
    final poller = minio.listenBucketNotification(bucket, events: [
      's3:PutObject:*',
    ]);
    poller.stream.listen((event) {
      print(event);
      print('--- event: ${event['eventName']}');
      // Get.find<EntriesController>(tag: "newEntry").videoUploadProgress[0];
    });
  }

But this listener not fires. Then here I found that Digital Ocean does not support Bucket Informations: https://developers.digitalocean.com/documentation/spaces/

Is there a way to get the upload progress when using the Digital Ocean storage? Thanks for your help!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

To implement upload progress tracking in your Flutter application when using DigitalOcean Spaces, you can consider the following client-side approaches:

  • Track Upload Progress on the Client Side: You can track the upload progress on the client side using Flutter itself. The minio package you mentioned may not provide a built-in way to track progress, but you can implement it manually using Flutter’s own mechanisms. You would typically need to divide the file into chunks and update the progress as each chunk is uploaded.

  • Custom Backend for Progress Tracking: Create a custom backend server that interacts with DigitalOcean Spaces and serves as an intermediary between your Flutter app and Spaces. The backend can track upload progress and provide progress updates to your Flutter app through an API. This way, you can have more control over progress tracking.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.