toggleObscurity method

void toggleObscurity(
  1. String id
)

Use this function to toggle controller's obscurity status using the unique id you supplied earlier!

{@tool snippet}

        onPressed: () {
          //* Toggle controller obscurity value
          _formController.toggleObscurity("id1")
}

{@end-tool}

Implementation

void toggleObscurity(String id) {
  if (_textControllers.containsKey(id) && _textControllers[id] != null) {
    _obscurity[id] = !_obscurity[id]!;
  } else {
    throw Exception(
        "No controllers found with the provided id, Did you create a controller with this id? Did you wait for the controller to initializ?");
  }
}