Ad
NullPointerException Flutter_local_notifications Does Not Work After Version-Update
I just updated my Flutter Local Notification Plugin https://pub.dev/packages/flutter_local_notifications to the latest Release (9.1.1) in an old project because the schedule Method was declared deprecated. Therefore I used the new Method zonedSchedule .
I took the zonedSchedule example from the doc to test it but now there is an exception every time the Notification is scheduled:
await flutterLocalNotificationsPlugin.zonedSchedule(
0,
'scheduled title',
'scheduled body',
tz.TZDateTime.now(tz.local).add(const Duration(seconds: 5)),
const NotificationDetails(
android: AndroidNotificationDetails(
'your channel id', 'your channel name',
channelDescription: 'your channel description')),
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime);
Here is the Exception
E/AndroidRuntime(15499): java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.MethodChannel$Result.success(java.lang.Object)' on a null object reference
E/AndroidRuntime(15499): at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin$2$1.run(FlutterLocalNotificationsPlugin.java:371)
E/AndroidRuntime(15499): at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime(15499): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(15499): at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime(15499): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime(15499): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15499): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime(15499): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Does anyone know why this problem is being triggered now but everything was fine before?
Ad
Answer
There was an NPE issue in Version 9.1.1. It's fixed with the new release.
[9.1.2] [Android] Fix NPE issue 1378 from change introduced in 9.1.1 in updating how notifications were written to shared preferences
Ad
source: stackoverflow.com
Related Questions
- → How do you create a 12 or 24 mnemonics code for multiple cryptocurrencies (ETH, BTC and so on..)
- → Flutter: input text field don't work properly in a simple example..... where am I wrong?
- → Can I customize the code formatting of Dart code in Atom?
- → Is it possible to develop iOS apps with Flutter on a Linux virtual machine?
- → Display SnackBar in Flutter
- → JSON ObjectMapper in Flutter
- → Material flutter app source code
- → TabBarSelection No such method error
- → How do I set the animation color of a LinearProgressIndicator?
- → Add different routes/screens to Flutter app
- → Is there a way to get the size of an existing widget?
- → How to share a file using flutter
- → Is there an easy way to find particular text built from RichText in a Flutter test?
Ad