flutter_downloader
flutter_downloader copied to clipboard
Compile error in v1.10.3 after upgrade from v1.10.2
Describe the bug
Compile error in v1.10.3 after upgrade from v1.10.2:
Error: The argument type 'void Function(String, DownloadTaskStatus, int)' can't be assigned to the parameter type 'void Function(String, int, int)'.
'DownloadTaskStatus' is from 'package:flutter_downloader/src/models.dart' ('../../../../../.pub-cache/hosted/pub.dev/flutter_downloader-1.10.3/lib/src/models.dart').
await FlutterDownloader.registerCallback(downloadCallback);
To Reproduce
Write a callback funtion in with parameters (String, DownloadTaskStatus, int) and register it in v1.10.2 -> works fine Use the same callback function in v1.10.3 -> fails to compile.
In v1.10.2 the callback function was defined as follows:
typedef DownloadCallback = void Function(
String id,
DownloadTaskStatus status,
int progress,
);
In v1.10.3 it changed to:
typedef DownloadCallback = void Function(
String id,
int status,
int progress,
);
Expected behavior
No compile errors. No breaking changes in patch version.
Same here.
try use https://pub.dev/packages/background_downloader
any update on this? I'm also facing this issue.
Please submit a PR and I'll be happy to release a hotfix.
I'm also facing this issue.
- Use
DownloadTaskStatus status, it get error: The argument type 'void Function(String, DownloadTaskStatus, int)' can't be assigned to the parameter type 'void Function(String, int, int)' - Use
int status, when download file: it get error: type 'int' is not a subtype of type 'DownloadTaskStatus' flutter_downloader
Please see #854