antenna 1.0.0 copy "antenna: ^1.0.0" to clipboard
antenna: ^1.0.0 copied to clipboard

A simple, lightweight state management library.

A simple, lightweight state management library.

Features #

Declare your various events. #

You can list all the events that will happen in your app.

Implement your tiny store. #

You can store the current state of a particular model separately.

Intercept the side effects. #

You should finish all the job with side effects before changing the state.

Keep your stores and effects for a certain period. #

You can also specify when your stores and effects is constructed and destoryed.

Getting started #

flutter pub add codux

Usage #

Declare your various events. #

const increment = "increment";

Implement your tiny store. #

final counterStore = createStore<int>(({
  int state = 0,
  dynamic event,
}) {
  if (event == increment) {
    return state + 1;
  }

  if (event == decrement) {
    return state - 1;
  }

  if (event is SetNumber) {
    return event.value;
  }

  return state;
});

Intercept the side effects. #

on((event) {
  if (event == random) {
    final value = Random().nextInt(100);

    dispatch(SetNumber(value));
  }
});

Keep your stores and effects for a certain period. #

class _MyHomePageState extends State<MyHomePage> with AntennaManager {
  @override
  void initState() {
    open(counterStore);
  }
  
  ...
}
0
likes
0
pub points
41%
popularity

Publisher

unverified uploader

A simple, lightweight state management library.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, rxdart

More

Packages that depend on antenna