withArg<Model, Msg, Arg> static method
MVUBuilder<Model, Msg>
withArg<Model, Msg, Arg>(
- Arg a, {
- required (Model, Cmd<
Msg> ) init(- Arg
- required (Model, Cmd<
Msg> ) update(- Msg,
- Model
- required MsgWidgetBuilder<
Model, Msg> view, - Subscription<
Model, Msg> ? subscriptions, - bool modelEquality(
- Model,
- Model
- void onDispose()?,
Creates a MVUBuilder with the given init, update and view functions.
initis called once with the givenargumentto return the initial model and commands.updateis called when a message is received to update the model and return new commands.viewis called to render the view and dispatch new messages.
Implementation
static MVUBuilder<Model, Msg> withArg<Model, Msg, Arg>(Arg a,
{required (Model, Cmd<Msg>) Function(Arg) init,
required (Model, Cmd<Msg>) Function(Msg, Model) update,
required MsgWidgetBuilder<Model, Msg> view,
Subscription<Model, Msg>? subscriptions,
bool Function(Model, Model)? modelEquality,
void Function()? onDispose}) =>
MVUBuilder._(
MVUProcessor.fromFunctions(
init: () => init(a),
update: update,
subscriptions: subscriptions,
modelEquality: modelEquality),
(BuildContext context, TickerProvider _, Model model,
Dispatch<Msg> dispatcher) =>
view(context, model, dispatcher),
onDispose: onDispose);