notifyListeners method
- @override
- @protected
- @Deprecated('This will throw an unsupported error. Use setState instead')
inherited
Overrides notifyListeners
to prevent direct calls.
This method is deprecated and will throw an UnsupportedError if called directly.
Use setState instead to update state and notify listeners automatically.
This ensures that state updates always go through the proper setState method, maintaining consistency and preventing potential bugs.
Implementation
@override
@protected
@Deprecated('This will throw an unsupported error. Use setState instead')
Never notifyListeners() {
throw UnsupportedError(
'Direct calls to notifyListeners() are not allowed. '
'Use setState() to update state and notify listeners.',
);
}