show method

  1. @override
Future<void> show(
  1. XNotification n
)
override

Posts (or replaces) a system notification. Same XNotification.id replaces any prior notification with that id. XNotification.threadId groups multiple notifications in the OS's notification UI.

Implementation

@override
Future<void> show(XNotification n) async {
  try {
    await _channel.invokeMethod('show', {
      'id': n.id,
      'title': n.title,
      'body': n.body,
      if (n.threadId != null) 'threadId': n.threadId,
      'data': n.data,
    });
  } on PlatformException catch (e) {
    _log.w('show failed: ${e.message}');
  } on MissingPluginException {
    return;
  }
}