@@ -293,6 +293,9 @@ void main() {
293
293
294
294
### Create new download task
295
295
296
+ The directory must be created in advance.
297
+ After that, you need to provide the path of the directory in the ` savedDir ` parameter.
298
+
296
299
``` dart
297
300
final taskId = await FlutterDownloader.enqueue(
298
301
url: 'your download link',
@@ -326,7 +329,7 @@ void initState() {
326
329
IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
327
330
_port.listen((dynamic data) {
328
331
String id = data[0];
329
- DownloadTaskStatus status = DownloadTaskStatus(data[1]);
332
+ DownloadTaskStatus status = DownloadTaskStatus.fromInt (data[1]);
330
333
int progress = data[2];
331
334
setState((){ });
332
335
});
@@ -342,8 +345,8 @@ void dispose() {
342
345
343
346
@pragma('vm:entry-point')
344
347
static void downloadCallback(String id, int status, int progress) {
345
- final SendPort send = IsolateNameServer.lookupPortByName('downloader_send_port');
346
- send.send([id, status, progress]);
348
+ final SendPort? send = IsolateNameServer.lookupPortByName('downloader_send_port');
349
+ send? .send([id, status, progress]);
347
350
}
348
351
349
352
```
@@ -354,13 +357,13 @@ avoid tree shaking in release mode for Android.
354
357
### Load all download tasks
355
358
356
359
``` dart
357
- final tasks = await FlutterDownloader.loadTasks();
360
+ final List<DownloadTask>? tasks = await FlutterDownloader.loadTasks();
358
361
```
359
362
360
363
### Load download tasks using a raw SQL query
361
364
362
365
``` dart
363
- final tasks = await FlutterDownloader.loadTasksWithRawQuery(query: query);
366
+ final List<DownloadTask>? tasks = await FlutterDownloader.loadTasksWithRawQuery(query: query);
364
367
```
365
368
366
369
In order to parse data into ` DownloadTask ` object successfully, you should load
0 commit comments