enabled property Null safety

bool enabled

Specifies whether a button is enabled.

When a button is disabled (the enabled property is set to false), the button is visible but cannot be clicked. The default value is true. This property is useful if you want to disable part of your navigation; for example, you might want to disable a button in the currently displayed page so that it can't be clicked and the page cannot be reloaded.

Note: To prevent mouseClicks on a button, set both the enabled and mouseEnabled properties to false.


bool get enabled => _enabled;
void enabled=(bool value)


set enabled(bool value) {
  if (_enabled != value) {
    _enabled = value;
    _state = SimpleButtonState.Up;