Flutter macOS Embedder
FlutterEngine() Category Reference

#import <FlutterEngine_Internal.h>

Inheritance diagram for FlutterEngine():

Instance Methods

(nullable FlutterViewController *) - viewControllerForId:
 
(void) - registerViewController:forId:
 
(void) - deregisterViewControllerForId:
 
(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 *) - viewControllerForId:
 
(void) - updateWindowMetricsForViewController:
 
(void) - sendPointerEvent:
 
(void) - sendKeyEvent:callback:userData:
 
(BOOL) - registerTextureWithID:
 
(BOOL) - markTextureFrameAvailable:
 
(BOOL) - unregisterTextureWithID:
 
(nonnull FlutterPlatformViewController *) - platformViewController
 
(void) - setApplicationState:
 
(void) - dispatchSemanticsAction:toTarget:withData:
 
(void) - handleAccessibilityEvent:
 
(void) - announceAccessibilityMessage:withPriority:
 
(NSArray< NSScreen * > *) - screens
 

Properties

NSMutableArray< NSNumber * > * isResponseValid
 
NSPointerArray * pluginAppDelegates
 
NSMutableDictionary< NSString *, FlutterEngineRegistrar * > * pluginRegistrars
 
BOOL running
 
FlutterRendererrenderer
 
FlutterEngineProcTable & embedderAPI
 
BOOL semanticsEnabled
 
NSString * executableName
 
FlutterPasteboardpasteboard
 
std::vector< std::string > switches
 
FlutterEngineTerminationHandlerterminationHandler
 

Detailed Description

Private interface declaration for FlutterEngine.

Definition at line 89 of file FlutterEngine.mm.

Method Documentation

◆ addViewController:

- (void) addViewController: (FlutterViewController *)  viewController

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

Practically, since FlutterEngine can only be attached with one controller, the given controller, if successfully attached, will always have the default view ID kFlutterImplicitViewId.

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.

◆ deregisterViewControllerForId:

- (void) deregisterViewControllerForId: (FlutterViewId viewId

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.)

◆ 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:forId:

- (void) registerViewController: (FlutterViewController *)  controller
forId: (FlutterViewId viewId 

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.

Practically, since FlutterEngine can only be attached with one controller for now, the given controller must be the current view controller.

◆ screens

- (NSArray<NSScreen*>*) screens

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

◆ sendKeyEvent:callback:userData:

- (void) sendKeyEvent: (const FlutterKeyEvent &)  event
callback: (nullable FlutterKeyEventCallback)  callback
userData: (nullable void *)  userData 

Dispatches the given pointer event data to engine.

◆ 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
stateOne 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.

◆ viewControllerForId: [1/2]

- (nullable FlutterViewController*) viewControllerForId: (FlutterViewId viewId

◆ viewControllerForId: [2/2]

- (nullable FlutterViewController*) viewControllerForId: (FlutterViewId viewId

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

◆ viewControllerViewDidLoad:

- (void) viewControllerViewDidLoad: (FlutterViewController *)  viewController

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

Property Documentation

◆ embedderAPI

- (FlutterEngineProcTable&) embedderAPI
readwritenonatomicassign

Function pointers for interacting with the embedder.h API.

Definition at line 97 of file FlutterEngine_Internal.h.

◆ executableName

- (NSString*) executableName
readnonatomicassign

The executable name for the current process.

Definition at line 108 of file FlutterEngine_Internal.h.

◆ isResponseValid

- (NSMutableArray<NSNumber*>*) isResponseValid
readwritenonatomicstrong

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 96 of file FlutterEngine.mm.

◆ pasteboard

- (FlutterPasteboard*) pasteboard
readwritenonatomicassign

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

Definition at line 113 of file FlutterEngine_Internal.h.

◆ pluginAppDelegates

- (NSPointerArray*) pluginAppDelegates
readwritenonatomicstrong

All delegates added via plugin calls to addApplicationDelegate.

Definition at line 101 of file FlutterEngine.mm.

◆ pluginRegistrars

- (NSMutableDictionary<NSString*, FlutterEngineRegistrar*>*) pluginRegistrars
readnonatomicassign

All registrars returned from registrarForPlugin:

Definition at line 107 of file FlutterEngine.mm.

◆ renderer

- (FlutterRenderer*) renderer
readnonatomicassign

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

Definition at line 92 of file FlutterEngine_Internal.h.

◆ running

- (BOOL) running
readnonatomicassign

True if the engine is currently running.

Definition at line 86 of file FlutterEngine_Internal.h.

◆ semanticsEnabled

- (BOOL) semanticsEnabled
readwritenonatomicassign

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 103 of file FlutterEngine_Internal.h.

◆ switches

- (vector<)std:
readnonatomicassign

The command line arguments array for the engine.

Definition at line 118 of file FlutterEngine_Internal.h.

◆ terminationHandler

- (FlutterEngineTerminationHandler*) terminationHandler
readnonatomicassign

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

Definition at line 123 of file FlutterEngine_Internal.h.


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