controllerFor method

TextEditingController controllerFor(
  1. FieldId fieldId
)

Implementation

TextEditingController controllerFor(FieldId fieldId) {
  if (state.controllerMap.containsKey(fieldId) == false) {
    if (state is DocumentState) {
      final DocumentState pageState = state as DocumentState;
      emit(pageState.copyWith(controllerMap: {
        ...pageState.controllerMap,
        fieldId: TextEditingController(),
      }) as T);
    } else {
      emit(state.copyWith(controllerMap: {
        ...state.controllerMap,
        fieldId: TextEditingController(),
      }) as T);
    }
  }
  return state.controllerMap[fieldId]!;
}