textEditingControllerObserve<ObservedState, S, A> static method
WithStore<ObservedState, A>
textEditingControllerObserve<ObservedState, S, A>({
- required Store<
S, A> store, - required ObservedState observe(
- S observedState
- required String toText(
- S state
- required A fromTextEditingAction(
- TextEditingAction action
- required TextEditingControllerWithStoreBuilder<
ObservedState, A> builder, - bool isEqual(
- ObservedState previous,
- ObservedState current
- Key? key,
Combines state observation with a TextEditingController binding.
Projects state via observe for selective rebuilds while maintaining
two-way text synchronization.
Implementation
static WithStore<ObservedState, A> textEditingControllerObserve<ObservedState, S, A>({
required Store<S, A> store,
required ObservedState Function(S observedState) observe,
required String Function(S state) toText,
required A Function(TextEditingAction action) fromTextEditingAction,
required TextEditingControllerWithStoreBuilder<ObservedState, A> builder,
bool Function(ObservedState previous, ObservedState current) isEqual = IsEqualUtils.stateAreEquals,
Key? key,
}) =>
WithStore<ObservedState, A>(
store: store.scope(toLocalState: observe, toGlobalAction: (action) => action),
builder: (state, send, context) => TextEditingControllerBuilder<S, A>(
key: key,
builder: (controller, focusNode) => builder(
state,
send,
context,
controller,
focusNode,
),
store: store,
toText: toText,
fromTextEditingAction: fromTextEditingAction,
),
isEqual: isEqual,
);