flutter_downloader icon indicating copy to clipboard operation
flutter_downloader copied to clipboard

Compile error in v1.10.3 after upgrade from v1.10.2

Open kast-ppi opened this issue 2 years ago • 6 comments

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.

kast-ppi avatar May 15 '23 09:05 kast-ppi

Same here.

bermanapps avatar May 16 '23 18:05 bermanapps

try use https://pub.dev/packages/background_downloader

kauemurakami avatar May 19 '23 17:05 kauemurakami

any update on this? I'm also facing this issue.

najeebkhan12 avatar May 28 '23 15:05 najeebkhan12

Please submit a PR and I'll be happy to release a hotfix.

bartekpacia avatar Jun 24 '23 00:06 bartekpacia

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

huynguyen96419 avatar Jul 03 '23 09:07 huynguyen96419

Please see #854

bartekpacia avatar Jul 03 '23 09:07 bartekpacia