File tree Expand file tree Collapse file tree 4 files changed +8
-11
lines changed
Expand file tree Collapse file tree 4 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ void initState() {
320320 IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
321321 _port.listen((dynamic data) {
322322 String id = data[0];
323- DownloadTaskStatus status = data[1];
323+ DownloadTaskStatus status = DownloadTaskStatus( data[1]) ;
324324 int progress = data[2];
325325 setState((){ });
326326 });
@@ -335,7 +335,7 @@ void dispose() {
335335}
336336
337337@pragma('vm:entry-point')
338- static void downloadCallback(String id, DownloadTaskStatus status, int progress) {
338+ static void downloadCallback(String id, int status, int progress) {
339339 final SendPort send = IsolateNameServer.lookupPortByName('downloader_send_port');
340340 send.send([id, status, progress]);
341341}
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ class _MyHomePageState extends State<MyHomePage> {
9090 @pragma ('vm:entry-point' )
9191 static void downloadCallback (
9292 String id,
93- DownloadTaskStatus status,
93+ int status,
9494 int progress,
9595 ) {
9696 print (
@@ -99,7 +99,7 @@ class _MyHomePageState extends State<MyHomePage> {
9999 );
100100
101101 IsolateNameServer .lookupPortByName ('downloader_send_port' )
102- ? .send ([id, status.value , progress]);
102+ ? .send ([id, status, progress]);
103103 }
104104
105105 Widget _buildDownloadList () {
Original file line number Diff line number Diff line change @@ -4,8 +4,6 @@ import 'dart:ui';
44import 'package:flutter/services.dart' ;
55import 'package:flutter/widgets.dart' ;
66
7- import 'models.dart' ;
8-
97/// Pragma annotation is needed to avoid tree shaking in release mode. See
108/// https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/aot/entry_point_pragma.md
119@pragma ('vm:entry-point' )
@@ -30,7 +28,7 @@ void callbackDispatcher() {
3028 final status = args[2 ] as int ;
3129 final progress = args[3 ] as int ;
3230
33- callback (id, DownloadTaskStatus ( status) , progress);
31+ callback (id, status, progress);
3432 })
3533 ..invokeMethod <void >('didInitializeDispatcher' );
3634}
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import 'dart:io';
44import 'dart:ui' ;
55
66import 'package:flutter/services.dart' ;
7- import 'package:flutter/widgets.dart' ;
87import 'package:flutter_downloader/src/exceptions.dart' ;
98
109import 'callback_dispatcher.dart' ;
@@ -14,7 +13,7 @@ import 'models.dart';
1413/// with [id] changes.
1514typedef DownloadCallback = void Function (
1615 String id,
17- DownloadTaskStatus status,
16+ int status,
1817 int progress,
1918);
2019
@@ -396,7 +395,7 @@ class FlutterDownloader {
396395 /// IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
397396 /// _port.listen((dynamic data) {
398397 /// String id = data[0];
399- /// DownloadTaskStatus status = data[1];
398+ /// DownloadTaskStatus status = DownloadTaskStatus( data[1]) ;
400399 /// int progress = data[2];
401400 /// setState((){ });
402401 /// });
@@ -406,7 +405,7 @@ class FlutterDownloader {
406405 ///
407406 ///static void downloadCallback(
408407 /// String id,
409- /// DownloadTaskStatus status,
408+ /// int status,
410409 /// int progress,
411410 /// ) {
412411 /// final SendPort send = IsolateNameServer.lookupPortByName(
You can’t perform that action at this time.
0 commit comments