didHaveMemoryPressure method
Called when the system is running low on memory.
Implementation
@protected
@override
@mustCallSuper
void didHaveMemoryPressure() {
// A triggered system event
_hadSystemEvent = true;
///
/// This method exposes the `memoryPressure` notification from
/// [SystemChannels.system].
/// No 'setState()' functions are allowed to fully function at this point.
_setStateAllowed = false;
for (final listener in _beforeList) {
listener.didHaveMemoryPressure();
}
for (final con in _controllerList) {
con.didHaveMemoryPressure();
}
for (final listener in _afterList) {
listener.didHaveMemoryPressure();
}
_setStateAllowed = true;
if (_setStateRequested) {
_setStateRequested = false;
// Only the latest State is rebuilt
if (isEndState) {
/// Perform a 'rebuild' if requested.
setState(() {});
}
}
}