Dev-hwang / flutter_foreground_task

This plugin is used to implement a foreground service on the Android platform.
https://pub.dev/packages/flutter_foreground_task
MIT License
149 stars 109 forks source link

API change from 8.6 to 8.10 breaks semantic versioning #280

Closed reduxdj closed 1 month ago

reduxdj commented 1 month ago

All of a suddren a ^8.6.0 in our pubspec fails on our windows builds.

2024-09-26T17:22:26.9245596Z [        ]   [        ] /C:/Users/runneradmin/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_foreground_task-8.10.0/lib/task_handler.dart:6:16: Context: This is the overridden method ('onStart').
2024-09-26T17:22:26.9251955Z [        ]   [        ]   Future<void> onStart(DateTime timestamp, TaskStarter starter);
2024-09-26T17:22:26.9252926Z [        ]   [        ]                ^
2024-09-26T17:22:26.9253779Z [        ]   [        ]  - 'Future' is from 'dart:async'.
2024-09-26T17:22:26.9258124Z [        ]   [        ] Change to a subtype of 'Future<void>'.
2024-09-26T17:22:26.9259056Z [        ]   [        ]   void onDestroy(DateTime timestamp) {
2024-09-26T17:22:26.9259775Z [        ]   [        ]        ^
2024-09-26T17:22:26.9270748Z [        ]   [        ] /C:/Users/runneradmin/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_foreground_task-8.10.0/lib/task_handler.dart:16:16: Context: This is the overridden method ('onDestroy').
2024-09-26T17:22:26.9272743Z [        ]   [        ]   Future<void> onDestroy(DateTime timestamp);
2024-09-26T17:22:26.9273477Z [        ]   [        ]                ^
Dev-hwang commented 1 month ago

@reduxdj

As said in the update note, the callback function has been redefined.

check migration_documentation

// ver 8.6.0
@override
void onStart(DateTime timestamp) { }

@override
void onDestroy(DateTime timestamp) { }

// ver 8.10.0
@override
Future<void> onStart(DateTime timestamp, TaskStarter starter) async { }

@override
Future<void> onDestroy(DateTime timestamp) async { }