setupNotifications method

Future<void> setupNotifications()

Implementation

Future<void> setupNotifications() async {
  if (isFlutterLocalNotificationsInitialized) {
    return;
  }
  if (Platform.isAndroid) {
    channel = AndroidNotificationChannel(
      observer.androidNotificationChannel,
      observer.androidNotificationChannelName,
      description: observer.androidNotificationChannelDescription,
      importance: Importance.high,
    );

    /// Create an Android Notification Channel.
    ///
    /// We use this channel in the `AndroidManifest.xml` file to override the
    /// default FCM channel to enable heads up notifications.
    await flutterLocalNotificationsPlugin
        .resolvePlatformSpecificImplementation<
            AndroidFlutterLocalNotificationsPlugin>()
        ?.createNotificationChannel(channel);
  }
  isFlutterLocalNotificationsInitialized = true;
}