controller method
Use this function to supply a text field with the required controller,make sure to use a unique id!
{@tool snippet}
TextFormField(
controller: _formController.controller("id2"),
),
{@end-tool}
Implementation
TextEditingController controller(String id,
{String? initialText, bool isObscure = false}) {
late TextEditingController ret;
if (_textControllers.containsKey(id) && _textControllers[id] != null) {
ret = _textControllers[id]!;
} else {
TextEditingController newCon = TextEditingController(text: initialText);
_textControllers.addEntries([MapEntry(id, newCon)]);
_obscurity.addEntries([MapEntry(id, isObscure)]);
ret = newCon;
}
return ret;
}