Flutter Uploader
A plugin for creating and managing upload tasks. Supports iOS and Android.
This plugin is based on WorkManager in Android and NSURLSessionUploadTask in iOS to run upload task in background mode.
This plugin is inspired by flutter_downloader. Thanks to Hung Duy Ha & Flutter Community for great plugins and inspiration.
iOS integration
- Enable background mode.

AppDelegate changes
The plugin supports a background isolate. In order for plugins to work, you need to adjust your AppDelegate as follows:
Optional configuration:
- Configure maximum number of connection per host: the plugin allows 3 simultaneous http connection per host running at a moment by default. You can change this number by adding following codes to your
Info.plist
file.
- Configure maximum number of concurrent upload operation: the plugin allows 3 simultaneous upload operation running at a moment by default. You can change this number by adding following codes to your
Info.plist
file.
- Configure request timeout: controls how long (in seconds) a task should wait for additional data to arrive before giving up
Info.plist
file.
Android integration
Optional configuration:
- Configure maximum number of concurrent tasks: the plugin depends on
WorkManager
library andWorkManager
depends on the number of available processor to configure the maximum number of tasks running at a moment. You can setup a fixed number for this configuration by adding following codes to yourAndroidManifest.xml
:
Usage
Import package:
Configure a background isolate entry point
First, define a top-level function:
The backgroundHandler function needs to be either a static function or a top level function to be accessible as a Flutter entry point.
Once you have a function defined, configure it in your main FlutterUploader
object like so:
To see how it all works, check out the example.
Create new upload task:
multipart/form-data:
binary uploads:
The plugin will return a taskId
which is unique for each upload. Hold onto it if you in order to cancel specific uploads.
listen for upload progress
listen for upload result
when tasks are cancelled, it will send on onError handler as exception with status = cancelled
Upload results are persisted by the plugin and will be submitted on each .listen
.
It is advised to keep a list of processed uploads in App side and call clearUploads
on the FlutterUploader plugin once they can be removed.