11# listenable_stream
22
3- - Convert Flutter's ` Listenable ` (eg . ` ChangeNotifier ` ) to ` Stream ` .
4- - Convert Flutter's ` ValueListenable ` (eg. ` ValueNotifier ` ) to ` ValueStream ` (incl. replay and not replay).
3+ - Convert Flutter's ` Listenable ` (e.g . ` ChangeNotifier ` ) to ` Stream ` .
4+ - Convert Flutter's ` ValueListenable ` (e.g. ` ValueNotifier ` ) to ` ValueStream ` (incl. " replay" and " not replay" ).
55
66[ ![ Pub Version] ( https://img.shields.io/pub/v/listenable_stream?include_prereleases )] ( https://pub.dev/packages/listenable_stream )
77[ ![ codecov] ( https://codecov.io/gh/Flutter-Dart-Open-Source/listenable_stream/branch/master/graph/badge.svg?token=6eORcR6Web )] ( https://codecov.io/gh/Flutter-Dart-Open-Source/listenable_stream )
8- [ ![ Flutter Tests] ( https://github.com/Flutter-Dart-Open-Source/listenable_stream/workflows/Flutter%20Tests/badge.svg )] ( https://github.com/Flutter-Dart-Open-Source/listenable_stream.git )
8+ [ ![ Flutter Tests] ( https://github.com/Flutter-Dart-Open-Source/listenable_stream/actions/workflows/flutter.yml/badge.svg )] ( https://github.com/Flutter-Dart-Open-Source/listenable_stream/actions/workflows/flutter.yml )
9+ [ ![ GitHub] ( https://img.shields.io/github/license/hoc081098/flutter_bloc_pattern?color=4EB1BA )] ( https://opensource.org/licenses/MIT )
10+ [ ![ Style] ( https://img.shields.io/badge/style-lints-40c4ff.svg )] ( https://pub.dev/packages/lints )
11+ [ ![ Hits] ( https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FFlutter-Dart-Open-Source%2Flistenable_stream&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false )] ( https://hits.seeyoufarm.com )
912
1013- [x] ` Listenable ` ▶ ` Stream<Listenable> `
1114- [x] ` ValueListenable<T> ` ▶ ` ValueStream<T> `
1215
1316## Usage
1417
1518### Listenable.toStream()
19+
1620``` dart
1721final ChangeNotifier changeNotifier = ChangeNotifier();
1822final Stream<ChangeNotifier> stream = changeNotifier.toStream();
@@ -23,6 +27,7 @@ changeNotifier.notifyListeners();
2327```
2428
2529### ValueListenable.toValueStream()
30+
2631``` dart
2732final ValueNotifier<int> valueNotifier = ValueNotifier(0);
2833final ValueListenableStream<int> stream = valueNotifier.toValueStream();
@@ -34,6 +39,7 @@ print(stream.value); // prints 2
3439```
3540
3641### ValueListenable.toValueStream(replayValue: true)
42+
3743``` dart
3844final ValueNotifier<int> valueNotifier = ValueNotifier(0);
3945final ValueListenableStream<int> stream = valueNotifier.toValueStream(replayValue: true);
0 commit comments