Skip to content

Commit

Permalink
Update stream.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
rodydavis committed Nov 20, 2024
1 parent c1fe818 commit b89ce27
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/signals_core/lib/src/mixins/stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import '../../signals_core.dart';
/// [Stream] implementation for [AsyncState]
mixin StreamSignalMixin<T> on ReadonlySignal<T> implements Stream<T> {
final _controller = StreamController<T>.broadcast(sync: true);
void Function()? _cleanup;

late final Stream<T> _stream = () {
final s = toStream();
_cleanup = subscribe(_controller.add);
onDispose(subscribe(_controller.add));
return s;
}();

@override
void dispose() {
_cleanup?.call();
_controller.close();
super.dispose();
}
Expand Down

0 comments on commit b89ce27

Please sign in to comment.