MVUProvider<Model, Msg> constructor
MVUProvider<Model, Msg> ({})
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);