NotificationService constructor

NotificationService()

Creates a new notification service

Implementation

NotificationService() {
  // Try to listen for notification actions
  try {
    _eventChannel.receiveBroadcastStream().listen(
      (dynamic event) {
        final action = event as String;
        _actionController.add(action);
        _actionCallback?.call(action);
      },
      onError: (error) {
        if (error is PlatformException || error is MissingPluginException) {
          _platformImplementationAvailable = false;
          debugPrint('Notification service not available on this platform');
        }
      },
    );
  } catch (e) {
    _platformImplementationAvailable = false;
    debugPrint('Notification service not available: $e');
  }
}