show method

int show({
  1. int? id,
  2. String? title,
  3. String? body,
  4. String? payload,
  5. bool? androidAllowWhileIdle,
  6. String? icon,
  7. Importance? importance,
  8. Priority? priority,
  9. StyleInformation? styleInformation,
  10. bool? playSound,
  11. AndroidNotificationSound? sound,
  12. bool? enableVibration,
  13. List<int>? vibrationPattern,
  14. String? groupKey,
  15. bool? setAsGroupSummary,
  16. GroupAlertBehavior? groupAlertBehavior,
  17. bool? autoCancel,
  18. bool? ongoing,
  19. Color? color,
  20. AndroidBitmap<Object>? largeIcon,
  21. bool? onlyAlertOnce,
  22. bool? showWhen,
  23. int? when,
  24. bool? usesChronometer,
  25. bool? channelShowBadge,
  26. bool? showProgress,
  27. int? maxProgress,
  28. int? progress,
  29. bool? indeterminate,
  30. AndroidNotificationChannelAction? channelAction,
  31. bool? enableLights,
  32. Color? ledColor,
  33. int? ledOnMs,
  34. int? ledOffMs,
  35. String? ticker,
  36. NotificationVisibility? visibility,
  37. int? timeoutAfter,
  38. String? category,
  39. bool? fullScreenIntent,
  40. String? shortcutId,
  41. Int32List? additionalFlags,
  42. String? subText,
  43. String? tag,
  44. bool? presentAlert,
  45. bool? presentSound,
  46. bool? presentBadge,
  47. String? soundFile,
  48. int? badgeNumber,
  49. List<IOSNotificationAttachment>? attachments,
  50. List<MacOSNotificationAttachment>? macAttachments,
  51. String? subtitle,
  52. String? threadIdentifier,
})

Show the Notification.

Implementation

int show({
  int? id,
  String? title,
  String? body,
  String? payload,
  bool? androidAllowWhileIdle,
  String? icon,
  Importance? importance,
  Priority? priority,
  StyleInformation? styleInformation,
  bool? playSound,
  AndroidNotificationSound? sound,
  bool? enableVibration,
  List<int>? vibrationPattern,
  String? groupKey,
  bool? setAsGroupSummary,
  GroupAlertBehavior? groupAlertBehavior,
  bool? autoCancel,
  bool? ongoing,
  Color? color,
  AndroidBitmap<Object>? largeIcon,
  bool? onlyAlertOnce,
  bool? showWhen,
  int? when,
  bool? usesChronometer,
  bool? channelShowBadge,
  bool? showProgress,
  int? maxProgress,
  int? progress,
  bool? indeterminate,
  AndroidNotificationChannelAction? channelAction,
  bool? enableLights,
  Color? ledColor,
  int? ledOnMs,
  int? ledOffMs,
  String? ticker,
  NotificationVisibility? visibility,
  int? timeoutAfter,
  String? category,
  bool? fullScreenIntent,
  String? shortcutId,
  Int32List? additionalFlags,
  String? subText,
  String? tag,
  bool? presentAlert,
  bool? presentSound,
  bool? presentBadge,
  String? soundFile,
  int? badgeNumber,
  List<IOSNotificationAttachment>? attachments,
  List<MacOSNotificationAttachment>? macAttachments,
  String? subtitle,
  String? threadIdentifier,
}) {
  //
  final notificationSpecifics = _notificationDetails(
    title,
    body,
    payload,
    androidAllowWhileIdle,
    icon,
    importance,
    priority,
    styleInformation,
    playSound,
    sound,
    enableVibration,
    vibrationPattern,
    groupKey,
    setAsGroupSummary,
    groupAlertBehavior,
    autoCancel,
    ongoing,
    color,
    largeIcon,
    onlyAlertOnce,
    showWhen,
    when,
    usesChronometer,
    channelShowBadge,
    showProgress,
    maxProgress,
    progress,
    indeterminate,
    channelAction,
    enableLights,
    ledColor,
    ledOnMs,
    ledOffMs,
    ticker,
    visibility,
    timeoutAfter,
    category,
    fullScreenIntent,
    shortcutId,
    additionalFlags,
    subText,
    tag,
    presentAlert,
    presentSound,
    presentBadge,
    soundFile,
    badgeNumber,
    attachments,
    macAttachments,
    subtitle,
    threadIdentifier,
  );

  if (notificationSpecifics == null) {
    id = -1;
  } else {
    //
    try {
      //
      if (id == null || id < 0) {
        id = Random().nextInt(999);
      }

      _flutterLocalNotificationsPlugin!.show(
        id,
        title,
        body,
        notificationSpecifics,
        payload: payload,
      );
    } catch (ex) {
      id = -1;
      getError(ex);
    }
  }
  return id;
}