getNotificationStream method
Stream of notification tap events when app is already running. Emits a Map with 'isFromNotification' (bool) and 'payload' (String) keys.
Implementation
Stream<Map<String, dynamic>> getNotificationStream() {
_notificationStream ??= eventChannel.receiveBroadcastStream().map((event) {
if (event is Map) {
return {
'isFromNotification': event['isFromNotification'] ?? true,
'payload': event['payload']?.toString() ?? '{}',
};
}
return {
'isFromNotification': true,
'payload': '{}',
};
});
return _notificationStream!;
}