MVUProvider<Model, Msg> constructor

MVUProvider<Model, Msg>({
  1. required (Model, Cmd<Msg>) init(),
  2. required (Model, Cmd<Msg>) update(
    1. Msg,
    2. Model
    ),
  3. Subscription<Model, Msg>? subscriptions,
  4. Widget child = const SizedBox.shrink(),
  5. Effect<Msg>? onInit,
  6. Effect<Msg>? onDispose,
  7. Key? key,
})

Creates a MVUProvider with the given init, update functions.

  • init is called once to return the initial model and commands.
  • update is called when a message is received to update the model and return new commands.
  • subscriptions is called to return subscriptions to be executed if enabled by the model.
  • child is the widget to be rendered.
  • onInit is called when the widget is initialized.
  • onDispose is called when the widget is disposed.

Implementation

MVUProvider(
    {required (Model, Cmd<Msg>) Function() init,
    required (Model, Cmd<Msg>) Function(Msg, Model) update,
    Subscription<Model, Msg>? subscriptions,
    this.child = const SizedBox.shrink(),
    this.onInit,
    this.onDispose,
    super.key})
    : processor = MVUProcessor.fromFunctions(
          init: init, update: update, subscriptions: subscriptions);