beginEditState method

Future<EditState> beginEditState(
  1. int row,
  2. int col, {
  3. EditStartReason reason = EditStartReason.EDIT_START_PROGRAMMATIC,
  4. String? seedText,
  5. int? caretPosition,
  6. bool? formulaMode,
})

Begin editing the given cell and return the resulting edit state.

Implementation

Future<EditState> beginEditState(
  int row,
  int col, {
  EditStartReason reason = EditStartReason.EDIT_START_PROGRAMMATIC,
  String? seedText,
  int? caretPosition,
  bool? formulaMode,
}) async {
  final start = EditStart()
    ..row = row
    ..col = col
    ..reason = reason;
  if (seedText != null) {
    start.seedValue = _editorValueFromText(seedText);
  }
  if (caretPosition != null) {
    start.caretPosition = caretPosition;
  }
  final state = await VolvoxGridService.Edit(EditCommand()
    ..gridId = _gridId
    ..start = start);
  notifyListeners();
  return state;
}