Persist Stream Data in SharedPreference. Simple and Easy Operator
in pubspec.yaml
dependencies:
stream_hydrated
The hydrate operator is automatically added to the Dart Streams API through Extensions. To use just import the package and use it directly in the stream.
import 'package:stream_hydrated/stream_hydrated.dart';
...
Stream stream = Stream<int>.empty().hydrated('number', seeded: 1);