map<Model, Msg> method

(Model, Cmd<Msg>) map<Model, Msg>(
  1. Model mapperModel(
    1. InnerModel innerModel
    ),
  2. Msg mapperMsg(
    1. InnerMsg inner
    )
)

This helper function can be used when going from a child update to a parent update.

Takes a function that returns the parent model from the child model, and a function that returns the parent message from the child message.

Implementation

(Model, Cmd<Msg>) map<Model, Msg>(
    Model Function(InnerModel innerModel) mapperModel,
    Msg Function(InnerMsg inner) mapperMsg) {
  final (innerModel, innerCmd) = this;
  return (mapperModel(innerModel), Cmd.map(innerCmd, mapperMsg));
}