| Flutter macOS Embedder |

Instance Methods | Class Methods | Properties | List of all members
FlutterEngine() Category Reference

`#import <FlutterEngine_Internal.h>`

Inheritance diagram for FlutterEngine():

## Instance Methods
(nullable FlutterViewController *) | - viewControllerForIdentifier:
(void) | - registerViewController:forIdentifier:
(void) | - deregisterViewControllerForIdentifier:
(void) | - shutDownIfNeeded
(void) | - sendUserLocales
(void) | - engineCallbackOnPlatformMessage:
(void) | - engineCallbackOnPreEngineRestart
(void) | - postMainThreadTask:targetTimeInNanoseconds:
(void) | - loadAOTData:
(void) | - setUpPlatformViewChannel
(void) | - setUpAccessibilityChannel
(void) | - handleMethodCall:result:
(void) | - addViewController:
(void) | - viewControllerViewDidLoad:
(void) | - removeViewController:
(nullable FlutterViewController *) | - viewControllerForIdentifier:
(void) | - updateWindowMetricsForViewController:
(void) | - sendPointerEvent:
(BOOL) | - registerTextureWithID:
(BOOL) | - markTextureFrameAvailable:
(BOOL) | - unregisterTextureWithID:
(nonnull FlutterPlatformViewController *) | - platformViewController
(void) | - setApplicationState:
(void) | - dispatchSemanticsAction:toTarget:withData:
(void) | - handleAccessibilityEvent:
(void) | - announceAccessibilityMessage:withPriority:
(NSArray< NSScreen * > *) | - screens
Instance Methods inherited from <FlutterMouseCursorPluginDelegate>
(void) | - didUpdateMouseCursor:
Instance Methods inherited from <FlutterKeyboardManagerDelegate>
(void) | - sendKeyEvent:callback:userData:
(nonnull id< FlutterBinaryMessenger >) | - binaryMessenger

## Class Methods
(nullable FlutterEngine *) | + engineForIdentifier:

## Properties
NSMutableArray< NSNumber * > * | isResponseValid
NSPointerArray * | pluginAppDelegates
NSMutableDictionary< NSString *, FlutterEngineRegistrar * > * | pluginRegistrars
BOOL | running
FlutterRenderer * | renderer
FlutterEngineProcTable & | embedderAPI
BOOL | semanticsEnabled
NSString * | executableName
FlutterPasteboard * | pasteboard
std::vector< std::string > | switches
FlutterEngineTerminationHandler * | terminationHandler
FlutterKeyboardManager * | keyboardManager
FlutterTextInputPlugin * | textInputPlugin
Properties inherited from <FlutterTextInputPluginDelegate>
id< FlutterBinaryMessenger > | binaryMessenger

## Detailed Description

Private interface declaration for FlutterEngine.

Definition at line 93 of file FlutterEngine.mm.

## Method Documentation

## ◆ addViewController:

- (void) addViewController: |  | (FlutterViewController *) | viewController |

Attach a view controller to the engine as its default controller.

Since FlutterEngine can only handle the implicit view for now, the given controller will always be assigned to the implicit view, if there isn't an implicit view yet. If the engine already has an implicit view, this call throws an assertion.

The engine holds a weak reference to the attached view controller.

If the given view controller is already attached to an engine, this call throws an assertion.

## ◆ announceAccessibilityMessage:withPriority:

- (void) announceAccessibilityMessage: |  | (NSString *) | message
withPriority: |  | (NSAccessibilityPriorityLevel) | priority

Announces accessibility messages.

## ◆ deregisterViewControllerForIdentifier:

- (void) deregisterViewControllerForIdentifier: |  | (FlutterViewIdentifier) | viewIdentifier |

An internal method that removes the view controller with the given ID.

This method clears the ID of the controller, removes the controller from the map. This is an no-op if the view ID is not associated with any view controllers.

## ◆ dispatchSemanticsAction:toTarget:withData:

- (void) dispatchSemanticsAction: |  | (FlutterSemanticsAction) | action
toTarget: |  | (uint16_t) | target
withData: |  | (fml::MallocMapping) | data

Dispatches semantics action back to the framework. The semantics must be enabled by calling the updateSemanticsEnabled before dispatching semantics actions.

## ◆ engineCallbackOnPlatformMessage:

- (void) engineCallbackOnPlatformMessage: |  | (const FlutterPlatformMessage *) | message |

Handles a platform message from the engine.

## ◆ engineCallbackOnPreEngineRestart

- (void) engineCallbackOnPreEngineRestart |  |  |

Invoked right before the engine is restarted.

This should reset states to as if the application has just started. It usually indicates a hot restart (Shift-R in Flutter CLI.)

## ◆ engineForIdentifier:

+ (nullable FlutterEngine*) engineForIdentifier: |  | (int64_t) | identifier |

Returns engine for the identifier. The identifier must be valid for an engine that is currently running, otherwise the behavior is undefined.

The identifier can be obtained in Dart code through `PlatformDispatcher.instance.engineId`.

This function must be called on the main thread.

## ◆ handleAccessibilityEvent:

- (void) handleAccessibilityEvent: |  | (NSDictionary< NSString *, id > *) | annotatedEvent |

Handles accessibility events.

## ◆ handleMethodCall:result:

- (void) handleMethodCall: |  | (FlutterMethodCall *) | call
result: |  | (FlutterResult) | result

Handles messages received from the Flutter engine on the _*Channel channels.

## ◆ loadAOTData:

- (void) loadAOTData: |  | (NSString *) | assetsDir |

Loads the AOT snapshots and instructions from the elf bundle (app_elf_snapshot.so) into _aotData, if it is present in the assets directory.

## ◆ markTextureFrameAvailable:

- (BOOL) markTextureFrameAvailable: |  | (int64_t) | textureID |

Marks texture with the given id as available. Returns YES on success.

## ◆ platformViewController

- (nonnull FlutterPlatformViewController*) platformViewController |  |  |

## ◆ postMainThreadTask:targetTimeInNanoseconds:

- (void) postMainThreadTask: |  | (FlutterTask) | task
targetTimeInNanoseconds: |  | (uint64_t) | targetTime

Requests that the task be posted back the to the Flutter engine at the target time. The target time is in the clock used by the Flutter engine.

## ◆ registerTextureWithID:

- (BOOL) registerTextureWithID: |  | (int64_t) | textureId |

Registers an external texture with the given id. Returns YES on success.

## ◆ registerViewController:forIdentifier:

- (void) registerViewController: |  | (FlutterViewController *) | controller
forIdentifier: |  | (FlutterViewIdentifier) | viewIdentifier

An internal method that adds the view controller with the given ID.

This method assigns the controller with the ID, puts the controller into the map, and does assertions related to the implicit view ID.

## ◆ removeViewController:

- (void) removeViewController: |  | (FlutterViewController *) | viewController |

Dissociate the given view controller from this engine.

If the view controller is not associated with this engine, this call throws an assertion.

## ◆ screens

- (NSArray<NSScreen*>*) screens |  |  |

Returns an array of screen objects representing all of the screens available on the system.

## ◆ sendPointerEvent:

- (void) sendPointerEvent: |  | (const FlutterPointerEvent &) | event |

Dispatches the given pointer event data to engine.

## ◆ sendUserLocales

- (void) sendUserLocales |  |  |

Sends the list of user-preferred locales to the Flutter engine.

## ◆ setApplicationState:

- (void) setApplicationState: |  | (flutter::AppLifecycleState) | state |

Handles changes to the application state, sending them to the framework.

Parameters

  state | One of the lifecycle constants in app_lifecycle_state.h, corresponding to the Dart enum AppLifecycleState.

## ◆ setUpAccessibilityChannel

- (void) setUpAccessibilityChannel |  |  |

Creates an accessibility channel and sets up the message handler.

## ◆ setUpPlatformViewChannel

- (void) setUpPlatformViewChannel |  |  |

Creates a platform view channel and sets up the method handler.

## ◆ shutDownIfNeeded

- (void) shutDownIfNeeded |  |  |

Shuts down the engine if view requirement is not met, and headless execution is not allowed.

## ◆ unregisterTextureWithID:

- (BOOL) unregisterTextureWithID: |  | (int64_t) | textureID |

Unregisters an external texture with the given id. Returns YES on success.

## ◆ updateWindowMetricsForViewController:

- (void) updateWindowMetricsForViewController: |  | (FlutterViewController *) | viewController |

Informs the engine that the specified view controller's window metrics have changed.

## ◆ viewControllerForIdentifier: [1/2]

- (nullable FlutterViewController*) viewControllerForIdentifier: |  | (FlutterViewIdentifier) | viewIdentifier |

Returns the FlutterViewController for the given view identifier.

Reimplemented from <FlutterTextInputPluginDelegate>.

## ◆ viewControllerForIdentifier: [2/2]

- (nullable FlutterViewController*) viewControllerForIdentifier: |  | (FlutterViewIdentifier) | viewIdentifier |

The |FlutterViewController| associated with the given view ID, if any.

Reimplemented from <FlutterTextInputPluginDelegate>.

## ◆ viewControllerViewDidLoad:

- (void) viewControllerViewDidLoad: |  | (FlutterViewController *) | viewController |

Notify the engine that a view for the given view controller has been loaded.

## Property Documentation

## ◆ embedderAPI

- (FlutterEngineProcTable&) embedderAPI
| read write nonatomic assign

Function pointers for interacting with the embedder.h API.

Definition at line 98 of file FlutterEngine_Internal.h.

## ◆ executableName

- (NSString*) executableName
| read nonatomic assign

The executable name for the current process.

Definition at line 109 of file FlutterEngine_Internal.h.

## ◆ isResponseValid

- (NSMutableArray<NSNumber*>*) isResponseValid
| read write nonatomic strong

A mutable array that holds one bool value that determines if responses to platform messages are clear to execute. This value should be read or written only inside of a synchronized block and will return `NO` after the FlutterEngine has been dealloc'd.

Definition at line 103 of file FlutterEngine.mm.

## ◆ keyboardManager

- (FlutterKeyboardManager*) keyboardManager
| read nonatomic assign

Returns keyboard manager for the engine.

Definition at line 219 of file FlutterEngine_Internal.h.

## ◆ pasteboard

- (FlutterPasteboard*) pasteboard
| read write nonatomic assign

This just returns the NSPasteboard so that it can be mocked in the tests.

Definition at line 114 of file FlutterEngine_Internal.h.

## ◆ pluginAppDelegates

- (NSPointerArray*) pluginAppDelegates
| read write nonatomic strong

All delegates added via plugin calls to addApplicationDelegate.

Definition at line 108 of file FlutterEngine.mm.

## ◆ pluginRegistrars

- (NSMutableDictionary<NSString*, FlutterEngineRegistrar*>*) pluginRegistrars
| read nonatomic assign

All registrars returned from registrarForPlugin:

Definition at line 114 of file FlutterEngine.mm.

## ◆ renderer

- (FlutterRenderer*) renderer
| read nonatomic assign

Provides the renderer config needed to initialize the engine and also handles external texture management.

Definition at line 93 of file FlutterEngine_Internal.h.

## ◆ running

- (BOOL) running
| read nonatomic assign

True if the engine is currently running.

Definition at line 87 of file FlutterEngine_Internal.h.

## ◆ semanticsEnabled

- (BOOL) semanticsEnabled
| read write nonatomic assign

True if the semantics is enabled. The Flutter framework starts sending semantics update through the embedder as soon as it is set to YES.

Definition at line 104 of file FlutterEngine_Internal.h.

## ◆ switches

- (vector<)std:
| read nonatomic assign

The command line arguments array for the engine.

Definition at line 119 of file FlutterEngine_Internal.h.

## ◆ terminationHandler

- (FlutterEngineTerminationHandler*) terminationHandler
| read nonatomic assign

Provides the |FlutterEngineTerminationHandler| to be used for this engine.

Definition at line 124 of file FlutterEngine_Internal.h.

## ◆ textInputPlugin

- (FlutterTextInputPlugin*) textInputPlugin
| read nonatomic assign

Returns text input plugin for the engine.

Definition at line 224 of file FlutterEngine_Internal.h.

The documentation for this category was generated from the following files:

- shell/platform/darwin/macos/framework/Source/FlutterEngine.mm
- shell/platform/darwin/macos/framework/Source/FlutterEngine_Internal.h