state 1.0.1 copy "state: ^1.0.1" to clipboard
state: ^1.0.1 copied to clipboard

outdatedDart 1 only

An observable map

state #

State is essentially an observable map, that reports changes to a stream.

Usage #

import 'package:state/state.dart';

main() {

  var state = new State.fromMap({
    'key': 'initial value'
  });

  state.listen((String key, newValue, oldValue) {

    print('$key was changed from $oldValue to $newValue');
  });

  state['key'] = 'new value';
}
main() // key was changed from initial value to new value

Apply #

Apply a new map to the state, and get events for all nodes that was created or changed.

state.apply({
  'new key': 'new value',
  'key': 'new value'
});
0
likes
0
points
3
downloads

Publisher

unverified uploader

Weekly Downloads

An observable map

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on state