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

outdated

Keep It Simple, Reactive State - A library for simplifying State management.

kisrs - Keep It Simple, Reactive State #

First, make a class for your state. If your class has a dispose() Function, it will be called on disposal.

class MyStore {
    MyStore(){};
    void dispose(){};
}

You can then attach an object of your class to a Store or StoreManager.

  • Store<T> just passes your data down the Widget tree
  • StoreManager<T> contains a Store and automatically calls the dispose() function when the Store is being disposed. Use this for cleanup.

You can access your Store with Store.of<T>(context).

DataPoints are how your store data in your state.

  • DataPoint<T>() creates a new DataPoint of a given Type that will be null initially.
  • DataPoint<T>.withValue() creates a new DataPoint of a given Type that contains initial data.

datapoint.value = 'Hello' sets the value of datapoint to 'Hello' and sends the new value to the stream.

datapoint.value is the current value.

datapoint.stream is is a stream of value changes. When you listen to it, it immediately sends the value.

datapoint.close() releases the memory used for the DataPoint. You must do this in order to prevent memory leaks!

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Keep It Simple, Reactive State - A library for simplifying State management.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, rxdart

More

Packages that depend on kisrs