'Flutter Web Focus Change Notifier event is emitted twice

When I click on Save Button in the UI, onFocusChanged is called twice and when I click outside the TextField, it calls 4 times.

onFocusChanged: (bool value) {
          widget.onFocusChanged?.call(value);

          ///Updating Save/Edit button state to be consistent with UI when Focus lost because of click on other components
          if (value == false && saveButtonEnabled && prevState) {
            saveButtonEnabled = false;
          }

          prevState = value;
        },


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source