persisted_bloc_stream

Last updated:

0 purchases

persisted_bloc_stream Image
persisted_bloc_stream Images
Add to Cart

Description:

persisted bloc stream

persisted_bloc_stream #
PersistedBlocStream is an extension of
BlocStream, that adds persistence for
offline caching etc.
Usage #
class CounterBlocActions {
static Future<void> increment(int i, _, StreamController<int> c) async {
yield i + 1;
c.add(i + 1);
}

static Future<void> decrement(int i, _, StreamController<int> c) async {
c.add(i - 1);
}
}

class CounterBloc extends PersistedBlocStream<int> {
CounterBloc() : super(0);

@override
int fromJson(json) => json;

@override
dynamic toJson(int value) => value;
}

void main() async {
WidgetsFlutterBinding.ensureInitialized();
PersistedBlocStream.storage = await HiveStorage.build();
runApp(MyApp());
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.