controllerFromId method

TextEditingController controllerFromId(
  1. String id
)

Retrieves the TextEditingController for the input field with the given id. Throws an exception if no input with the given id is found.

id: The unique identifier for the input field.

Implementation

TextEditingController controllerFromId(String id) {
  final input = inputs.where((e) => e.id == id).firstOrNull;

  if (input == null) {
    throw Exception('[FormManager] Invalid form input id ($id)');
  }

  return input.controller;
}