show method

Future<void> show(
  1. NotificationMessage message
)

Implementation

Future<void> show(NotificationMessage message) async {
  await _guard('display notification', () async {
    var current = message;
    for (final interceptor in config.interceptors) {
      final intercepted = await interceptor.beforeDisplay(current);
      if (intercepted == null) return;
      current = intercepted;
    }
    final channel =
        channels.find(current.channelId) ??
        channels.find(config.defaultChannelId) ??
        NotificationChannel.defaultChannel;
    await localNotifications.show(current, channel);
    for (final interceptor in config.interceptors.reversed) {
      await interceptor.afterDisplay(current);
    }
    final event = _notificationEvent(current, NotificationState.foreground);
    await _forEachAnalytics(
      (analytics) => analytics.notificationDisplayed(event),
    );
  });
}