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. bool modelEquality(
    1. Model,
    2. Model
    )?,
  5. Widget child = const SizedBox.shrink(),
  6. Effect<Msg>? onInit,
  7. Effect<Msg>? onDispose,
  8. 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.
  • modelEquality is used to compare the model and avoid unnecessary rebuilds.
  • 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,
    bool Function(Model, Model)? modelEquality,
    this.child = const SizedBox.shrink(),
    this.onInit,
    this.onDispose,
    super.key})
    : processor = MVUProcessor.fromFunctions(
          init: init,
          update: update,
          subscriptions: subscriptions,
          modelEquality: modelEquality);