NullPointerException flutter_local_notifications does not work after Version-Update


I just updated my Flutter Local Notification Plugin 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(
      'scheduled title',
      'scheduled body', Duration(seconds: 5)),
      const NotificationDetails(
          android: AndroidNotificationDetails(
              'your channel id', 'your channel name',
              channelDescription: 'your channel description')),
      androidAllowWhileIdle: true,

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$
E/AndroidRuntime(15499):    at android.os.Handler.handleCallback(
E/AndroidRuntime(15499):    at android.os.Handler.dispatchMessage(
E/AndroidRuntime(15499):    at android.os.Looper.loop(
E/AndroidRuntime(15499):    at
E/AndroidRuntime(15499):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(15499):    at$
E/AndroidRuntime(15499):    at

Does anyone know why this problem is being triggered now but everything was fine before?


There was an NPE issue in Version 9.1.1. It’s fixed with the new release.

[Android] Fix NPE issue 1378 from change introduced in 9.1.1 in updating how notifications were written to shared preferences

Answered By – Robin.S

Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *