flutter_local_notifications
flutter_local_notifications copied to clipboard
Building with flutter 3.3 breaks the onSelectionNotificationAction
I will fill in a proper bug report later, butjust for fyi. This showed in logging after building with 3.3
09-07 11:10:18.324 9901 11011 E flutter : [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library ‘package:flutter_local_notifications/src/callback_dispatcher.dart’ not found. 09-07 11:10:18.325 9901 11011 E flutter : [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function. 09-07 11:10:18.325 9901 11011 E flutter : [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint. 09-07 11:10:18.326 9901 11011 E flutter : [ERROR:flutter/runtime/runtime_controller.cc(385)] Could not create root isolate. 09-07 11:10:18.326 9901 11011 E flutter : [ERROR:flutter/shell/common/shell.cc(604)] Could not launch engine with configuration.
Then after multiple tries and finally switching back to 3.0.5 it started working again.
Describe the bug
To Reproduce
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior
Sample code to reproduce the problem
Update a local build with iOS behaves the same
I can't reproduce the issue you're seeing so if you believe the issue is to do with the plugin then i'll need a link to a repository hosting a minimal app that can reproduce the problem.
In saying that, the details you shared would points to your build environment not being able to locate a file that should be there. Have you checked your pub cache to see if the file is there and if not, tried to repair the cache? This is outside the control of the plugin.
I suspect something might have changed in the tree shaker of dart 2.18 such that the file gets optimized out
@Kavantix good call there. Hadn't thought of that as it wasn't call out in release notes. I took a look and saw that a number of other libraries are experiencing the same issue and use this annotation to fix it. It'll also be needed in the plugin so try to get an update out for it
@codaveto this commit has the changes and will be released shortly https://github.com/MaikuB/flutter_local_notifications/pull/1406/commits/c0fc1d5be54ce3d52e4a51b3d95bd487eb027c85. I'm pointing out the commit as the title of your issue would indicate you're using an older pre-release so it might be need you to apply similar changes to your fork
Edit: spoke too soon, ran into a problem on Android so will need to see what else is missing
It probably makes sense to update example
and docs about onDidReceiveBackgroundNotificationResponse
(the user-specified callback should have @pragma('vm:entry-point')
for the same reason).
@noinskit that was done in the commit mentioned in my post. Haven't done it yet for API docs yet so will do so later but less likely community will read that. Currently I'm still running into issues with the example app but it seems it the callback is invoked and that it's using the isolate name server to pass messages that runs into issues so may have omit that from examples etc and keep the example minimal to print messages. If anyone knows how to fix this in a release build then please submit a PR
Published a new release with the changes. Will keep the issue open to see if others can confirm if they still run into an issue or not
I have not encountered this issue on Android using Flutter 3.3.2 with flutter_local_notifications
11.0.0.
Closing as this was fixed and confirmed to have solved the issue. I've also opened an issue (see https://github.com/flutter/website/issues/7564) on the Flutter website repository to ask if documentation around this could be improved