observe<GlobalState, NullableState, GlobalAction, A> static method
IfLetStore<NullableState, A>
observe<GlobalState, NullableState, GlobalAction, A>({
- Key? key,
- required Store<
GlobalState, GlobalAction> store, - required Widget builder(
- BuildContext context,
- Store<
NullableState, A> store
- required NullableState? toNullableState(
- GlobalState state
- required GlobalAction toGlobalAction(
- A action
- Widget orElse(
- BuildContext context
override
Creates an IfLetStore by projecting nullable state from a global store.
Uses toNullableState to extract the optional child state and
toGlobalAction to embed child actions into the global action type.
Implementation
static IfLetStore<NullableState, A> observe<GlobalState, NullableState, GlobalAction, A>({
Key? key,
required Store<GlobalState, GlobalAction> store,
required Widget Function(BuildContext context, Store<NullableState, A> store) builder,
required NullableState? Function(GlobalState state) toNullableState,
required GlobalAction Function(A action) toGlobalAction,
Widget Function(BuildContext context)? orElse,
}) =>
IfLetStore(
store: store.scope(
toLocalState: toNullableState,
toGlobalAction: toGlobalAction,
),
builder: builder,
orElse: orElse,
);