showNotification method
Future<int>
showNotification({
- int? id,
- required String title,
- required String message,
- String? channelId,
- NotificationImportance? importance,
- bool? autoCancel,
- String? targetScreen,
- Map<
String, dynamic> ? extraData,
override
Show a simple notification.
Returns the notification ID.
Implementation
@override
Future<int> showNotification({
int? id,
required String title,
required String message,
String? channelId,
NotificationImportance? importance,
bool? autoCancel,
String? targetScreen,
Map<String, dynamic>? extraData,
}) async {
final result = await methodChannel.invokeMethod<int>('showNotification', {
'id': ?id,
'title': title,
'message': message,
'channelId': ?channelId,
if (importance != null) 'priority': importance.value,
'autoCancel': ?autoCancel,
'targetScreen': ?targetScreen,
'extraData': ?extraData,
});
return result ?? -1;
}