File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -58,18 +58,23 @@ Future<String> download(String url) async {
58
58
final response = await dio.download (
59
59
url,
60
60
savePath,
61
+ options: Options (
62
+ headers: {HttpHeaders .acceptEncodingHeader: '*' }, // Disable gzip
63
+ ),
61
64
onReceiveProgress: (received, total) {
62
- final progress = (received / total * 100 ).toInt ();
65
+ if (total <= - 1 ) return ;
66
+
67
+ final progress = ((received / total) * 100 ).toInt ();
63
68
showProgress (progress);
64
69
},
65
70
);
66
71
67
72
final contentType =
68
73
(response.headers.map['content-type' ] as List )[0 ] as String ;
69
74
70
- final extion = contentType.split ('/' ).last;
75
+ final fileExtension = contentType.split ('/' ).last;
71
76
72
- final newSavePath = renameIfNoExtenion (savePath, extion );
77
+ final newSavePath = renameIfNoExtenion (savePath, fileExtension );
73
78
74
79
if (newSavePath != null ) return newSavePath;
75
80
You can’t perform that action at this time.
0 commit comments