updateFocus method

void updateFocus(
  1. bool hasFocus, {
  2. bool emitEvent = true,
})

Update the focus state for controller.

Provide the hasFocus argument to set the focus state.

If emitEvent is true or not provided (the default) then an event is triggered with the new focus state. If is false no event is triggered.

Implementation

void updateFocus(bool hasFocus, {bool emitEvent = true}) {
  if (_hasFocus != hasFocus) {
    _hasFocus = hasFocus;
    if (emitEvent && !disposed) {
      notifyListeners();
    }
  }
}