chunked_uploader

Creator: coderz1093

Last updated:

Add to Cart

Description:

chunked uploader

Chunked Uploader #
A plugin to upload files to server in chunks.

Usage #
To use this plugin, add chunked_uploader as dependency in your pubspec.yaml file.
dependencies:
flutter:
sdk: flutter
chunked_uploader: ^1.0.0
file_picker: ^5.2.5
dio: ^4.0.6
copied to clipboard
Example #
final file =
(await FilePicker.platform.pickFiles(withReadStream: true))!.files.single;
final dio = Dio(BaseOptions(
baseUrl: 'https://example.com/api',
headers: {'Authorization': 'Bearer'},
));
final uploader = ChunkedUploader(dio);

// using data stream
final response = await uploader.upload(
fileName: file.name,
fileSize: file.size,
fileDataStream: file.readStream!,
maxChunkSize: 500000,
path: '/file',
onUploadProgress: (progress) => print(progress),
);
// using path
final response = await uploader.uploadUsingFilePath(
fileName: file.name,
filePath: file.path!,
maxChunkSize: 500000,
path: '/file',
onUploadProgress: (progress) => print(progress),
);
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.