Upgrading flutter_local_notifications 0.9 to 1
Breaking0.9.1+3 → 1.5.0+1Breaking18Platform2Deprecated1New21Changed13Fixed14Other45
BreakingUpgrade verdict
18 breaking changes and 2 platform requirement changes.
In plain terms
- Enum values now use lower camel case, so `Default` becomes `defaultImportance` or `defaultPriority`.
- Old workaround code for notifications scheduled before version 0.3.4 is gone, which simplifies maintenance.
- If your app showed media-style notifications, you now set the style through a separate style information object instead of a style property.
- Bitmaps are now passed as objects that carry both the bitmap and where it comes from, so the separate source properties are gone.
Must act Top 5 of 21 that need code or config changes
Dart SDK requirement changed in 1.5.0+1: >=2.0.0-dev.28.0 <3.0.0 → >=2.0.0 <3.0.0.
Flutter requirement changed in 1.1.5: >=1.10.0 <2.0.0 → >=1.12.13+hotfix.5.
What you must change
Breaking18
Renames all enum values to lower camel case, including
Day, Importance, Priority, RepeatInterval and others.DayAndroidNotificationChannelActionImportancePriorityGroupAlertBehaviorNotificationVisibilityRepeatIntervaldefaultImportanceRemoves the Android kludge added in 0.3.4 that fixed timestamps of notifications scheduled prior to 0.3.4.
Removes the redundant
style property from AndroidNotificationDetails; media notifications must now use styleInformation with MediaNotificationStyleInformation.AndroidNotificationDetailsstylestyleInformationAndroidNotificationStyle.MediaMediaNotificationStyleInformationReplaces the
BitmapSource enum with the AndroidBitmap abstract class and subclasses, removing largeIconBitmapSource and bigPictureBitmapSource.BitmapSourceAndroidBitmapAndroidNotificationDetailslargeIconlargeIconBitmapSourceBigPictureStyleInformationbigPicturebigPictureBitmapSourceReplaces the
IconSource enum with the AndroidIcon abstract class and subclasses, changing Person.icon to AndroidIcon and removing iconSource.IconSourceAndroidIconPersoniconiconSourceDrawableResourceAndroidIconBitmapFilePathAndroidIconContentUriAndroidIconRemoves the static instance properties from IOSFlutterLocalNotificationsPlugin and AndroidFlutterLocalNotificationsPlugin.
IOSFlutterLocalNotificationsPluginAndroidFlutterLocalNotificationsPlugininstanceresolvePlatformSpecificImplementation()Removes public access to plugin callbacks.
Reverts the breaking 1.5.0 update because it should have been published with the major version incremented.
InitializationSettings and NotificationDetails now use named parameters android, iOS and macOS instead of positional parameters.InitializationSettingsNotificationDetailsandroidiOSmacOSThe internal
toMap method used to transfer data over platform channels is no longer publicly accessible.toMapAdds assertions to the
IOSInitializationSettings constructor to prevent null values being passed in.IOSInitializationSettingsChanges the
sound property of AndroidNotificationDetails from String to the new AndroidNotificationSound type, with RawResourceAndroidNotificationSound and UriAndroidNotificationSound…AndroidNotificationSoundAndroidNotificationDetailssoundRawResourceAndroidNotificationSoundUriAndroidNotificationSoundMakes all properties of
AndroidNotificationDetails, DefaultStyleInformation and InboxStyleInformation final.AndroidNotificationDetailsDefaultStyleInformationInboxStyleInformation[iOS] Plugin now throws a PlatformException when the native addNotificationRequest call returns an error, instead of only logging it natively.
PlatformExceptionaddNotificationRequestNSLogThe static
values properties for Day and Importance now return typed lists instead of dynamic.Day.valuesImportance.valuesDayImportancePassing a null notification id now throws an ArgumentError.
ArgumentError[iOS] Local notifications that launched the app are now only processed by the plugin if the plugin created them.
Adds iOS checks so callbacks are only invoked for notifications originating from the plugin, improving compatibility with other notification plugins.
Platform2
Adds support for the Android v2 embedding, with a known Flutter SDK issue causing onSelectNotification to fire twice on Android.
onSelectNotificationRequires Flutter SDK 1.12.3+hotfix.6 or greater.
Deprecations to plan for
Deprecated1
Deprecates
schedule, showDailyAtTime and showWeeklyAtDayAndTime due to time zone problems, especially daylight savings.scheduleshowDailyAtTimeshowWeeklyAtDayAndTimeAPI changes
Generated by DepDelta from published Dart source. Not mixed with prose notes.
- removed:
class NotificationAppLaunchDetails - removed:
class PendingNotificationRequest - removed:
ctor NotificationAppLaunchDetails( this.didNotificationLaunchApp, this.payload) - removed:
ctor PendingNotificationRequest( this.id, this.title, this.body, this.payload) - removed:
ctor StyleInformation() - removed:
enum BitmapSource - removed:
enum IconSource - removed:
enum RepeatInterval - removed:
field AndroidNotificationDetails.largeIconBitmapSource: BitmapSource - removed:
field AndroidNotificationDetails.style: AndroidNotificationStyle - removed:
field BigPictureStyleInformation.bigPictureBitmapSource: final BitmapSource - removed:
field BigPictureStyleInformation.largeIconBitmapSource: final BitmapSource - removed:
field FlutterLocalNotificationsPlugin.didReceiveLocalNotificationCallback: DidReceiveLocalNotificationCallback - removed:
field FlutterLocalNotificationsPlugin.selectNotificationCallback: SelectNotificationCallback - removed:
field NotificationAppLaunchDetails.didNotificationLaunchApp: final bool - removed:
field NotificationAppLaunchDetails.payload: final String - removed:
field PendingNotificationRequest.body: final String - removed:
field PendingNotificationRequest.id: final int - removed:
field PendingNotificationRequest.payload: final String - removed:
field PendingNotificationRequest.title: final String - removed:
field Person.iconSource: final IconSource - removed:
member BitmapSource.Drawable - removed:
member BitmapSource.FilePath - removed:
member IconSource.ContentUri - removed:
member IconSource.Drawable - removed:
member IconSource.FilePath - removed:
member RepeatInterval.Daily - removed:
member RepeatInterval.EveryMinute - removed:
member RepeatInterval.Hourly - removed:
member RepeatInterval.Weekly - changed:
class DefaultStyleInformation extends StyleInformation → class DefaultStyleInformation implements StyleInformation - changed:
ctor AndroidNotificationDetails( this.channelId, this.channelName, this.channelDescription, {this.icon, this.importance = …, this.priority = …, this.style = …, this.styleInformation, this.playSound = …, this.sound, this.enableVibration = …, this.vibrationPattern, this.groupKey, this.setAsGroupSummary, this.groupAlertBehavior = …, this.autoCancel = …, this.ongoing, this.color, this.largeIcon, this… → ctor AndroidNotificationDetails( this.channelId, this.channelName, this.channelDescription, { this.icon, this.importance = …, this.priority = …, this.styleInformation, this.playSound = …, this.sound, this.enableVibration = …, this.vibrationPattern, this.groupKey, this.setAsGroupSummary, this.groupAlertBehavior = …, this.autoCancel = …, this.ongoing, this.color, this.largeIcon, this.onlyAlertOnce,… - changed:
ctor BigPictureStyleInformation(this.bigPicture, this.bigPictureBitmapSource, {this.contentTitle, this.summaryText, this.htmlFormatContentTitle = …, this.htmlFormatSummaryText = …, this.largeIcon, this.largeIconBitmapSource, bool htmlFormatContent = …, bool htmlFormatTitle = …, this.hideExpandedLargeIcon = …}) → ctor BigPictureStyleInformation( this.bigPicture, { this.contentTitle, this.summaryText, this.htmlFormatContentTitle = …, this.htmlFormatSummaryText = …, this.largeIcon, bool htmlFormatContent = …, bool htmlFormatTitle = …, this.hideExpandedLargeIcon = …, }) - changed:
ctor BigTextStyleInformation(this.bigText, {this.htmlFormatBigText = …, this.contentTitle, this.htmlFormatContentTitle = …, this.summaryText, this.htmlFormatSummaryText = …, bool htmlFormatContent = …, bool htmlFormatTitle = …}) → ctor BigTextStyleInformation( this.bigText, { this.htmlFormatBigText = …, this.contentTitle, this.htmlFormatContentTitle = …, this.summaryText, this.htmlFormatSummaryText = …, bool htmlFormatContent = …, bool htmlFormatTitle = …, }) - changed:
ctor DefaultStyleInformation(this.htmlFormatContent, this.htmlFormatTitle) → ctor DefaultStyleInformation( this.htmlFormatContent, this.htmlFormatTitle, ) - changed:
ctor FlutterLocalNotificationsPlugin.private( MethodChannel channel, Platform platform) → ctor FlutterLocalNotificationsPlugin.private(Platform platform) - changed:
ctor IOSInitializationSettings( {this.requestAlertPermission = …, this.requestSoundPermission = …, this.requestBadgePermission = …, this.defaultPresentAlert = …, this.defaultPresentSound = …, this.defaultPresentBadge = …, this.onDidReceiveLocalNotification}) → ctor IOSInitializationSettings({ this.requestAlertPermission = …, this.requestSoundPermission = …, this.requestBadgePermission = …, this.defaultPresentAlert = …, this.defaultPresentSound = …, this.defaultPresentBadge = …, this.onDidReceiveLocalNotification, }) - changed:
ctor IOSNotificationDetails( {this.presentAlert, this.presentBadge, this.presentSound, this.sound}) → ctor IOSNotificationDetails({ this.presentAlert, this.presentBadge, this.presentSound, this.sound, this.badgeNumber, this.attachments, }) - changed:
ctor InboxStyleInformation(this.lines, {this.htmlFormatLines = …, this.contentTitle, this.htmlFormatContentTitle = …, this.summaryText, this.htmlFormatSummaryText = …, bool htmlFormatContent = …, bool htmlFormatTitle = …}) → ctor InboxStyleInformation( this.lines, { this.htmlFormatLines = …, this.contentTitle, this.htmlFormatContentTitle = …, this.summaryText, this.htmlFormatSummaryText = …, bool htmlFormatContent = …, bool htmlFormatTitle = …, }) - changed:
ctor InitializationSettings(this.android, this.ios) → ctor InitializationSettings( this.android, this.ios, ) - changed:
ctor Message(this.text, this.timestamp, this.person, {this.dataMimeType, this.dataUri}) → ctor Message( this.text, this.timestamp, this.person, { this.dataMimeType, this.dataUri, }) - changed:
ctor MessagingStyleInformation(this.person, {this.conversationTitle, this.groupConversation, this.messages, bool htmlFormatContent = …, bool htmlFormatTitle = …}) → ctor MessagingStyleInformation( this.person, { this.conversationTitle, this.groupConversation, this.messages, bool htmlFormatContent = …, bool htmlFormatTitle = …, }) - changed:
ctor NotificationDetails(this.android, this.iOS) → ctor NotificationDetails( this.android, this.iOS, ) - changed:
ctor Person( {this.bot, this.icon, this.iconSource, this.important, this.key, this.name, this.uri}) → ctor Person({ this.bot, this.icon, this.important, this.key, this.name, this.uri, }) - changed:
ctor Time([this.hour = …, this.minute = …, this.second = …]) → ctor Time([ this.hour = …, this.minute = …, this.second = …, ]) - changed:
field AndroidNotificationDetails.autoCancel: bool → field AndroidNotificationDetails.autoCancel: final bool - changed:
field AndroidNotificationDetails.channelAction: AndroidNotificationChannelAction → field AndroidNotificationDetails.channelAction: final AndroidNotificationChannelAction - changed:
field AndroidNotificationDetails.color: Color → field AndroidNotificationDetails.color: final Color - changed:
field AndroidNotificationDetails.enableLights: bool → field AndroidNotificationDetails.enableLights: final bool - changed:
field AndroidNotificationDetails.enableVibration: bool → field AndroidNotificationDetails.enableVibration: final bool - changed:
field AndroidNotificationDetails.groupAlertBehavior: GroupAlertBehavior → field AndroidNotificationDetails.groupAlertBehavior: final GroupAlertBehavior - changed:
field AndroidNotificationDetails.groupKey: String → field AndroidNotificationDetails.groupKey: final String - changed:
field AndroidNotificationDetails.importance: Importance → field AndroidNotificationDetails.importance: final Importance - changed:
field AndroidNotificationDetails.indeterminate: bool → field AndroidNotificationDetails.indeterminate: final bool - changed:
field AndroidNotificationDetails.largeIcon: String → field AndroidNotificationDetails.largeIcon: final AndroidBitmap - changed:
field AndroidNotificationDetails.ledColor: Color → field AndroidNotificationDetails.ledColor: final Color - changed:
field AndroidNotificationDetails.ledOffMs: int → field AndroidNotificationDetails.ledOffMs: final int - changed:
field AndroidNotificationDetails.ledOnMs: int → field AndroidNotificationDetails.ledOnMs: final int - changed:
field AndroidNotificationDetails.maxProgress: int → field AndroidNotificationDetails.maxProgress: final int - changed:
field AndroidNotificationDetails.ongoing: bool → field AndroidNotificationDetails.ongoing: final bool - changed:
field AndroidNotificationDetails.onlyAlertOnce: bool → field AndroidNotificationDetails.onlyAlertOnce: final bool - changed:
field AndroidNotificationDetails.playSound: bool → field AndroidNotificationDetails.playSound: final bool - changed:
field AndroidNotificationDetails.priority: Priority → field AndroidNotificationDetails.priority: final Priority - changed:
field AndroidNotificationDetails.progress: int → field AndroidNotificationDetails.progress: final int - changed:
field AndroidNotificationDetails.setAsGroupSummary: bool → field AndroidNotificationDetails.setAsGroupSummary: final bool - changed:
field AndroidNotificationDetails.showProgress: bool → field AndroidNotificationDetails.showProgress: final bool - changed:
field AndroidNotificationDetails.sound: String → field AndroidNotificationDetails.sound: final AndroidNotificationSound - changed:
field AndroidNotificationDetails.styleInformation: StyleInformation → field AndroidNotificationDetails.styleInformation: final StyleInformation - changed:
field AndroidNotificationDetails.ticker: String → field AndroidNotificationDetails.ticker: final String - changed:
field AndroidNotificationDetails.vibrationPattern: Int64List → field AndroidNotificationDetails.vibrationPattern: final Int64List - changed:
field AndroidNotificationDetails.visibility: NotificationVisibility → field AndroidNotificationDetails.visibility: final NotificationVisibility - changed:
field BigPictureStyleInformation.bigPicture: final String → field BigPictureStyleInformation.bigPicture: final AndroidBitmap - changed:
field BigPictureStyleInformation.largeIcon: final String → field BigPictureStyleInformation.largeIcon: final AndroidBitmap - changed:
field DefaultStyleInformation.htmlFormatContent: bool → field DefaultStyleInformation.htmlFormatContent: final bool - changed:
field DefaultStyleInformation.htmlFormatTitle: bool → field DefaultStyleInformation.htmlFormatTitle: final bool - changed:
field InboxStyleInformation.lines: List<String> → field InboxStyleInformation.lines: final List<String> - changed:
field Person.icon: final String → field Person.icon: final AndroidIcon - changed:
static get Day.values → static get Day.values: List<Day> - changed:
static get Importance.values → static get Importance.values: List<Importance> - changed:
static get Priority.values → static get Priority.values: List<Priority> - added:
class AndroidBitmap: abstract - added:
class AndroidFlutterLocalNotificationsPlugin extends MethodChannelFlutterLocalNotificationsPlugin - added:
class AndroidNotificationChannel - added:
class AndroidNotificationSound: abstract - added:
class BitmapFilePathAndroidIcon implements AndroidIcon - added:
class ContentUriAndroidIcon implements AndroidIcon - added:
class DrawableResourceAndroidBitmap implements AndroidBitmap - added:
class DrawableResourceAndroidIcon implements AndroidIcon - added:
class FilePathAndroidBitmap implements AndroidBitmap - added:
class FlutterBitmapAssetAndroidIcon implements AndroidIcon - added:
class IOSFlutterLocalNotificationsPlugin extends MethodChannelFlutterLocalNotificationsPlugin - added:
class IOSNotificationAttachment - added:
class MediaStyleInformation extends DefaultStyleInformation - added:
class RawResourceAndroidNotificationSound implements AndroidNotificationSound - added:
class UriAndroidNotificationSound implements AndroidNotificationSound - added:
ctor AndroidNotificationChannel( this.id, this.name, this.description, { this.importance = …, this.playSound = …, this.sound, this.enableVibration = …, this.vibrationPattern, this.showBadge = …, this.enableLights = …, this.ledColor, }) - added:
ctor BitmapFilePathAndroidIcon(this._icon) - added:
ctor ContentUriAndroidIcon(this._icon) - added:
ctor DrawableResourceAndroidBitmap(this._bitmap) - added:
ctor DrawableResourceAndroidIcon(this._icon) - added:
ctor FilePathAndroidBitmap(this._bitmap) - added:
ctor FlutterBitmapAssetAndroidIcon(this._icon) - added:
ctor IOSNotificationAttachment( this.filePath, { this.identifier, }) - added:
ctor MediaStyleInformation({ bool htmlFormatContent = …, bool htmlFormatTitle = …, }) - added:
ctor RawResourceAndroidNotificationSound(this._sound) - added:
ctor UriAndroidNotificationSound(this._sound) - added:
field AndroidNotificationChannel.description: final String - added:
field AndroidNotificationChannel.enableLights: final bool - added:
field AndroidNotificationChannel.enableVibration: final bool - added:
field AndroidNotificationChannel.id: final String - added:
field AndroidNotificationChannel.importance: final Importance - added:
field AndroidNotificationChannel.ledColor: final Color - added:
field AndroidNotificationChannel.name: final String - added:
field AndroidNotificationChannel.playSound: final bool - added:
field AndroidNotificationChannel.showBadge: final bool - added:
field AndroidNotificationChannel.sound: final AndroidNotificationSound - added:
field AndroidNotificationChannel.vibrationPattern: final Int64List - added:
field AndroidNotificationDetails.additionalFlags: final Int32List - added:
field AndroidNotificationDetails.category: final String - added:
field AndroidNotificationDetails.showWhen: final bool - added:
field AndroidNotificationDetails.timeoutAfter: final int - added:
field AndroidNotificationDetails.when: final int - added:
field IOSNotificationAttachment.filePath: final String - added:
field IOSNotificationAttachment.identifier: final String - added:
field IOSNotificationDetails.attachments: final List<IOSNotificationAttachment> - added:
field IOSNotificationDetails.badgeNumber: final int - added:
get AndroidBitmap.bitmap: String - added:
get AndroidNotificationSound.sound: String - added:
get BitmapFilePathAndroidIcon.icon: String - added:
get ContentUriAndroidIcon.icon: String - added:
get DrawableResourceAndroidBitmap.bitmap: String - added:
get DrawableResourceAndroidIcon.icon: String - added:
get FilePathAndroidBitmap.bitmap: String - added:
get FlutterBitmapAssetAndroidIcon.icon: String - added:
get RawResourceAndroidNotificationSound.sound: String - added:
get UriAndroidNotificationSound.sound: String - added:
method AndroidFlutterLocalNotificationsPlugin.createNotificationChannel( AndroidNotificationChannel notificationChannel): Future<void> - added:
method AndroidFlutterLocalNotificationsPlugin.deleteNotificationChannel(String channelId): Future<void> - added:
method AndroidFlutterLocalNotificationsPlugin.initialize(AndroidInitializationSettings initializationSettings, {SelectNotificationCallback onSelectNotification}): Future<bool> - added:
method AndroidFlutterLocalNotificationsPlugin.periodicallyShow( int id, String title, String body, RepeatInterval repeatInterval, {AndroidNotificationDetails notificationDetails, String payload}): Future<void> - added:
method AndroidFlutterLocalNotificationsPlugin.schedule(int id, String title, String body, DateTime scheduledDate, AndroidNotificationDetails notificationDetails, {String payload, bool androidAllowWhileIdle = …}): Future<void> - added:
method AndroidFlutterLocalNotificationsPlugin.show(int id, String title, String body, {AndroidNotificationDetails notificationDetails, String payload}): Future<void> - added:
method AndroidFlutterLocalNotificationsPlugin.showDailyAtTime(int id, String title, String body, Time notificationTime, AndroidNotificationDetails notificationDetails, {String payload}): Future<void> - added:
method AndroidFlutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( int id, String title, String body, Day day, Time notificationTime, AndroidNotificationDetails notificationDetails, {String payload}): Future<void> - added:
method AndroidNotificationChannel.toMap(): Map<String, dynamic> - added:
method FlutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation< T extends FlutterLocalNotificationsPlatform>(): T - added:
method IOSFlutterLocalNotificationsPlugin.initialize(IOSInitializationSettings initializationSettings, {SelectNotificationCallback onSelectNotification}): Future<bool> - added:
method IOSFlutterLocalNotificationsPlugin.periodicallyShow( int id, String title, String body, RepeatInterval repeatInterval, {IOSNotificationDetails notificationDetails, String payload}): Future<void> - added:
method IOSFlutterLocalNotificationsPlugin.requestPermissions({bool sound, bool alert, bool badge}): Future<bool> - added:
method IOSFlutterLocalNotificationsPlugin.schedule(int id, String title, String body, DateTime scheduledDate, IOSNotificationDetails notificationDetails, {String payload}): Future<void> - added:
method IOSFlutterLocalNotificationsPlugin.show(int id, String title, String body, {IOSNotificationDetails notificationDetails, String payload}): Future<void> - added:
method IOSFlutterLocalNotificationsPlugin.showDailyAtTime(int id, String title, String body, Time notificationTime, IOSNotificationDetails notificationDetails, {String payload}): Future<void> - added:
method IOSFlutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( int id, String title, String body, Day day, Time notificationTime, IOSNotificationDetails notificationDetails, {String payload}): Future<void> - added:
method IOSNotificationAttachment.toMap(): Map<String, dynamic>