Skip to content

Upgrading flutter_local_notifications 8 to 9

Breaking8.2.0 → 9.9.1Breaking9Security1Platform4New10Changed6Fixed16Other15

BreakingUpgrade verdict

8 breaking changes and 4 platform requirement changes and a security fix.

  • AndroidIcon becomes generic AndroidIcon<T>, its icon property is renamed to data, and Person.icon is now AndroidIcon<Object>?.
  • If you set up notifications using settings meant for a different platform, the app now gives a clear error explaining what went wrong instead of crashing with a vague exception.
  • A field added to the Android notification info in version 9.1.0 has been removed again, because it could break existing apps. It will come back in a future major version.
  • Callback functions you provide no longer need to return a Future; they just run and finish.
Top 5 of 13 that need code or config changes
Breaking8
AndroidIcon becomes generic AndroidIcon<T>, its icon property is renamed to data, and Person.icon is now AndroidIcon<Object>?.
AndroidIconAndroidIcon.iconAndroidIcon.dataPerson.icon
Calling initialize() with the wrong platform's initialisation settings now throws an ArgumentError instead of an unhandled exception.
initialize()ArgumentError
Reverts the 9.1.0 change that added groupKey to ActiveNotification because it was potentially breaking; it will return in a major release.
ActiveNotificationgroupKey
SelectNotificationCallback and DidReceiveLocalNotificationCallback typedefs now return void instead of Future<dynamic>.
SelectNotificationCallbackDidReceiveLocalNotificationCallbackVoidCallback
Makes AndroidNotificationChannel.description and AndroidNotificationDetails.channelDescription named parameters, fixing issue 1306.
AndroidNotificationChannel.descriptionAndroidNotificationDetails.channelDescriptionAndroidNotificationChannelAndroidNotificationDetailsdescriptionchannelDescription
The value property of the Importance class is now non-nullable.
Importance.value
Removes the private FlutterLocalNotificationsPlugin.private() test constructor; platform is now detected via defaultTargetPlatform.
FlutterLocalNotificationsPlugin.private()defaultTargetPlatformdebugDefaultTargetPlatformOverride
Makes AndroidIcon a generic class AndroidIcon<T>, changing the type of Person.icon from AndroidIcon? to AndroidIcon<Object>?.
AndroidIconAndroidIcon<T>AndroidBitmap<T>PersonPerson.icon
Security1
Bumps the Android gson dependency to 2.8.9, fixing CVE-2022-25647.
gson
Platform4
Adds details to the 9.8.0 changelog noting apps must set compileSdkVersion to 33, and updates the readme to mention this.
compileSdkVersion
Requires the Android 13 SDK and compileSdkVersion 33 in the app's build.gradle because the plugin's compileSdkVersion is now 33.
compileSdkVersion
Adds Android 12 support.
Adds Android 12 support.