map<Model, Inner, Msg> static method
Map a subscription from one message type to another, keeping the same model.
Implementation
static Sub<Model, Msg> map<Model, Inner, Msg>(
String idPrefix, Sub<Model, Inner> sub, Msg Function(Inner) f) =>
Sub(sub._subs.map((inner) {
final (subId, subscribe) = inner;
return (
[idPrefix, ...subId],
(SubHandler<Model, Msg> handler) => subscribe(
SubHandler<Model, Inner>(
(Inner innerMsg) => handler.dispatch(f(innerMsg)),
() => handler.model))
);
}).toList());