flutter_local_notifications icon indicating copy to clipboard operation
flutter_local_notifications copied to clipboard

Building with flutter 3.3 breaks the onSelectionNotificationAction

Open devlifeofbrian opened this issue 2 years ago • 8 comments

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

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Sample code to reproduce the problem

devlifeofbrian avatar Sep 07 '22 10:09 devlifeofbrian

Update a local build with iOS behaves the same

devlifeofbrian avatar Sep 08 '22 08:09 devlifeofbrian

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.

MaikuB avatar Sep 11 '22 10:09 MaikuB

I suspect something might have changed in the tree shaker of dart 2.18 such that the file gets optimized out

Kavantix avatar Sep 12 '22 09:09 Kavantix

@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

MaikuB avatar Sep 12 '22 09:09 MaikuB

@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

MaikuB avatar Sep 12 '22 09:09 MaikuB

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 avatar Sep 12 '22 10:09 noinskit

@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

MaikuB avatar Sep 12 '22 10:09 MaikuB

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

MaikuB avatar Sep 12 '22 11:09 MaikuB

I have not encountered this issue on Android using Flutter 3.3.2 with flutter_local_notifications 11.0.0.

AdamBridges avatar Sep 21 '22 20:09 AdamBridges

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

MaikuB avatar Oct 04 '22 10:10 MaikuB