zustand 0.0.4 copy "zustand: ^0.0.4" to clipboard
zustand: ^0.0.4 copied to clipboard

The bear necessities for state management in Dart

example/zustand_example.dart

import 'package:zustand/zustand.dart';

class CounterStore extends Store<int> {
  CounterStore() : super(0);

  void increment() => set(state + 1);
  void reset() => set(0);
}

CounterStore useCounterStore() => create(() => CounterStore());

Future<void> main() async {
  final counter = useCounterStore();

  counter.stream.listen((state) {
    print('Counter: $state');
  });

  counter.increment();
  counter.increment();
  counter.reset();

  await StoreLocator().dispose();
}
5
likes
150
points
62
downloads

Publisher

verified publisherjosiahsaunders.com

Weekly Downloads

The bear necessities for state management in Dart

Repository (GitHub)
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on zustand