diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index ff9dc9c96f1..55751db9e49 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -174,6 +174,11 @@ void FlutterInit(int argc, const char* argv[]) { selector:@selector(onVoiceOverChanged:) name:UIAccessibilityVoiceOverStatusChanged object:nil]; + + [center addObserver:self + selector:@selector(onMemoryWarning:) + name:UIApplicationDidReceiveMemoryWarningNotification + object:nil]; } #pragma mark - Initializing the engine @@ -438,6 +443,13 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase( _platformView->ToggleAccessibility(self.view, enabled); } +#pragma mark - Memory Notifications + +- (void)onMemoryWarning:(NSNotification*)notification { + NSDictionary* message = @{ @"type" : @"memoryPressure" }; + [self sendJSON:message withMessageName:@"flutter/system"]; +} + #pragma mark - Locale updates - (void)onLocaleUpdated:(NSNotification*)notification {