Last updated:
0 purchases
observable value
A value wrapper for streams & ValueListenables that can be bound to a datasource.
The datasource can be another Stream, ValueListenable or a KVStore, which is a key-value store abstraction plugin.
var store = KVStore.build( 'test_box' );
await store.init();
await store.open();
const String key = 'test_key_1';
ObservableValue observable = ObservableValue<int>(
key: key,
defaultValue: 0,
);
observable.bind(
store,
);
expect( observable.value, equals( 0 ) );
await store.set( key, 1 );
expect( observable.value, equals( 1 ) );
await store.set( key, 2 );
expect( observable.value, equals( 2 ) );
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.