createBuilder<S, A> static method
dynamic
createBuilder<S, A>(
- Widget builder(
- BuildContext context,
- Store<
S, A> store
- Widget orElse(
- BuildContext context
- Store<
S?, A> store
Creates the internal builder that handles null/non-null branching.
Implementation
static createBuilder<S, A>(
Widget Function(BuildContext context, Store<S, A> store) builder,
final Widget Function(BuildContext context)? orElse,
Store<S?, A> store,
) {
return (state, send, context) {
if (state == null) {
return orElse?.call(context) ?? const SizedBox.shrink();
} else {
return builder(
context,
store.scopeState(toLocalState: (s) => s ?? state),
);
}
};
}