chunked_uploader 1.1.0 chunked_uploader: ^1.1.0 copied to clipboard
An easy-to-use package to upload files in chunks using Dio for mobile, desktop and web.
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),
);