Skip to content

Commit 26e3ba5

Browse files
notif test: Allow scheduling mock notification tap events before subscription
Initialize StreamController early, this will allow scheduling mock notification tap events (via `addNotificationTapEvent`) even before `notificationTapEventsStream` is called.
1 parent 9228efa commit 26e3ba5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/model/binding.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -779,16 +779,16 @@ class FakeNotificationPigeonApi implements NotificationPigeonApi {
779779
Future<NotificationDataFromLaunch?> getNotificationDataFromLaunch() async =>
780780
_notificationDataFromLaunch;
781781

782-
StreamController<NotificationTapEvent>? _notificationTapEventsStreamController;
782+
late final _notificationTapEventsStreamController =
783+
StreamController<NotificationTapEvent>();
783784

784785
void addNotificationTapEvent(NotificationTapEvent event) {
785-
_notificationTapEventsStreamController!.add(event);
786+
_notificationTapEventsStreamController.add(event);
786787
}
787788

788789
@override
789790
Stream<NotificationTapEvent> notificationTapEventsStream() {
790-
_notificationTapEventsStreamController ??= StreamController();
791-
return _notificationTapEventsStreamController!.stream;
791+
return _notificationTapEventsStreamController.stream;
792792
}
793793
}
794794

0 commit comments

Comments
 (0)