platform/core/queue/test/helpers/subscription.dart
2024-10-05 19:35:50 -07:00

20 lines
440 B
Dart

import 'package:angel3_reactivex/subjects.dart';
import 'app_event.dart';
typedef Responder<T> = void Function(T event);
class Subscription {
final BehaviorSubject<AppEvent> _subject;
Subscription(this._subject);
void respond<T>(Responder<T> responder) {
_subject.stream.where((event) => event is T).listen((event) {
responder(event as T);
});
}
void dispose() {
// Implement disposal logic if needed
}
}