handleMemoryPressure method

  1. @override
void handleMemoryPressure()
override

Called when the operating system notifies the application of a memory pressure situation.

This method exposes the memoryPressure notification from SystemChannels.system.

Implementation

@override
void handleMemoryPressure() {
  super.handleMemoryPressure();
  for (final observer in List<WidgetsBindingObserver>.of(_observers)) {
    try {
      observer.didHaveMemoryPressure();
    } catch (exception, stack) {
      FlutterError.reportError(
        FlutterErrorDetails(
          exception: exception,
          stack: stack,
          library: 'widgets library',
          context: ErrorDescription(
            'while dispatching notifications for WidgetsBindingObserver.didHaveMemoryPressure',
          ),
        ),
      );
    }
  }
}