lite_state library

Functions

disposeControllerByType(Type controllerType) → void
fc<T extends LiteStateController>() → T
fc - short for Find Controller
findController<T extends LiteStateController>() → T
initControllers(Map<Type, ControllerInitializer> controllerInitializers) → void
initControllersLazy(Map<Type, ControllerInitializer> controllerInitializers) → void
initJsonDecoders(Map<Type, ModelDecoderFunction> value) → void
Initializes JSON decoders for custom types (if you ever need to store anything custom in shared preferences), so they can be easily restored from SharedPreferences. Call this method someplace at the beginning of your app, just before you initialize LiteState controllers so that controllers can have access to this data before they are initialized themselves. Decoder MUST be a STATIC function that creates instances of custom classes from a map e.g. static AuthData decode(Map map) { return AuthData( type: map'type', token: map'token', userName: map'userName', ); } this function converts a Map, stored in SharedPreferences into a user defined object. In this case a custom class called AuthData
onPostframe(VoidCallback callback) → void
resetAllControllers({bool dispose = false}) → void
just calls a reset() method on all initialized controllers what this method should / should not do is up to you. Just write your own implementation if you need it

Typedefs

ControllerInitializer = LiteStateController Function()
LiteStateBuilder<T extends LiteStateController> = Widget Function(BuildContext context, T controller)
ModelDecoderFunction = LSJsonEncodable Function(Map<String, dynamic> json)