toggleObscureText method

dynamic toggleObscureText(
  1. String attribute
)

Toggles the obscure text mode for a specific attribute in the form.

Parameters:

  • attribute: The name of the attribute for which to toggle obscure text mode.

Description: This function allows you to dynamically switch between obscured and plain text display modes for a text input field associated with the specified attribute. If the attribute is in _overrideObscureText, it will be removed from the list, effectively enabling plain text display. If the attribute is not in the list, it will be added to _overrideObscureText, causing the text input field to display its content in obscured form (e.g., for passwords).

Implementation

toggleObscureText(String attribute) {
  if (_overrideObscureText.contains((attribute))) {
    _overrideObscureText.remove(attribute);
  } else {
    _overrideObscureText.add(attribute);
  }
  _getObscureNotifiers(attribute).value = isObscureText(attribute);
}