showNotification method

  1. @override
Future<int> showNotification({
  1. required String title,
  2. required String message,
  3. String? channelId,
  4. int? priority,
  5. bool? autoCancel,
  6. String? targetScreen,
  7. Map<String, dynamic>? extraData,
})
override

Show a simple notification.

Returns the notification ID.

Implementation

@override
Future<int> showNotification({
  required String title,
  required String message,
  String? channelId,
  int? priority,
  bool? autoCancel,
  String? targetScreen,
  Map<String, dynamic>? extraData,
}) async {
  final result = await methodChannel.invokeMethod<int>('showNotification', {
    'title': title,
    'message': message,
    if (channelId != null) 'channelId': channelId,
    if (priority != null) 'priority': priority,
    if (autoCancel != null) 'autoCancel': autoCancel,
    if (targetScreen != null) 'targetScreen': targetScreen,
    if (extraData != null) 'extraData': extraData,
  });
  return result ?? -1;
}