MVUBuilder<Model, Msg> constructor

MVUBuilder<Model, Msg>({
  1. required (Model, Cmd<Msg>) init(),
  2. required (Model, Cmd<Msg>) update(
    1. Msg,
    2. Model
    ),
  3. required MsgWidgetBuilder<Model, Msg> view,
  4. Subscription<Model, Msg>? subscriptions,
})

Creates a MVUBuilder with the given init, update and view 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.
  • view is called to render the view and dispatch new messages.

Implementation

MVUBuilder(
    {required (Model, Cmd<Msg>) Function() init,
    required (Model, Cmd<Msg>) Function(Msg, Model) update,
    required MsgWidgetBuilder<Model, Msg> view,
    Subscription<Model, Msg>? subscriptions})
    : this._(
          MVUProcessor.fromFunctions(
              init: init, update: update, subscriptions: subscriptions),
          ((BuildContext context, TickerProvider _, Model model,
                  Dispatch<Msg> dispatcher) =>
              view(context, model, dispatcher)));