Flutter Engine
The Flutter Engine
Instance Methods | Properties | List of all members
FlutterEngineRegistrar Class Reference
Inheritance diagram for FlutterEngineRegistrar:
<FlutterPluginRegistrar> <FlutterPluginRegistrar>

Instance Methods

(instancetype) - initWithPlugin:flutterEngine:
 
(instancetype) - initWithPlugin:flutterEngine:
 
(nullable NSView *) - viewForIdentifier:
 
(void) - dealloc [implementation]
 
(NSObject< FlutterBinaryMessenger > *) - messenger [implementation]
 
(NSObject< FlutterTextureRegistry > *) - textures [implementation]
 
(void) - publish: [implementation]
 
(void) - addMethodCallDelegate:channel: [implementation]
 
(void) - addApplicationDelegate: [implementation]
 
(NSString *) - lookupKeyForAsset: [implementation]
 
(NSString *) - lookupKeyForAsset:fromPackage: [implementation]
 
(void) - registerViewFactory:withId: [implementation]
 
(void) - registerViewFactory:withId:gestureRecognizersBlockingPolicy: [implementation]
 
(NSView *) - view [implementation]
 
(void) - addMethodCallDelegate:channel: [implementation]
 
(void) - addApplicationDelegate: [implementation]
 
(void) - registerViewFactory:withId: [implementation]
 
- Instance Methods inherited from <FlutterPluginRegistrar>
(NSObject< FlutterBinaryMessenger > *) - messenger
 
(NSObject< FlutterTextureRegistry > *) - textures
 
(void) - registerViewFactory:withId:
 
(void) - registerViewFactory:withId:gestureRecognizersBlockingPolicy:
 
(void) - publish:
 
(void) - addMethodCallDelegate:channel:
 
(void) - addApplicationDelegate:
 
(NSString *) - lookupKeyForAsset:
 
(NSString *) - lookupKeyForAsset:fromPackage:
 
(void) - addMethodCallDelegate:channel:
 
(void) - addApplicationDelegate:
 
(void) - registerViewFactory:withId:
 
(void) - publish:
 
(nonnull NSString *) - lookupKeyForAsset:
 
(nonnull NSString *) - lookupKeyForAsset:fromPackage:
 

Properties

FlutterEngineflutterEngine
 
NSObject * publishedValue
 
- Properties inherited from <FlutterPluginRegistrar>
id< FlutterBinaryMessengermessenger
 
id< FlutterTextureRegistrytextures
 
NSView * view
 

Detailed Description

FlutterPluginRegistrar implementation handling a single plugin.

Definition at line 89 of file FlutterEngine.mm.

Method Documentation

◆ addApplicationDelegate: [1/2]

- (void) addApplicationDelegate: ("Disallowed in plugins used in app extensions")  NS_EXTENSION_UNAVAILABLE_IOS
implementation

Registers the plugin as a receiver of UIApplicationDelegate calls.

Parameters
delegateThe receiving object, such as the plugin's main class.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 822 of file FlutterEngine.mm.

1533 :(NSObject<FlutterPlugin>*)delegate
1534 NS_EXTENSION_UNAVAILABLE_IOS("Disallowed in plugins used in app extensions") {
1535 id<UIApplicationDelegate> appDelegate = [[UIApplication sharedApplication] delegate];
1536 if ([appDelegate conformsToProtocol:@protocol(FlutterAppLifeCycleProvider)]) {
1537 id<FlutterAppLifeCycleProvider> lifeCycleProvider =
1538 (id<FlutterAppLifeCycleProvider>)appDelegate;
1539 [lifeCycleProvider addApplicationLifeCycleDelegate:delegate];
1540 }
1541}

◆ addApplicationDelegate: [2/2]

- (void) addApplicationDelegate: (NSObject<FlutterAppLifecycleDelegate>*)  delegate
implementation

Definition at line 323 of file FlutterEngine.mm.

370 :(NSObject<FlutterAppLifecycleDelegate>*)delegate {
371 id<NSApplicationDelegate> appDelegate = [[NSApplication sharedApplication] delegate];
372 if ([appDelegate conformsToProtocol:@protocol(FlutterAppLifecycleProvider)]) {
373 id<FlutterAppLifecycleProvider> lifeCycleProvider =
374 static_cast<id<FlutterAppLifecycleProvider>>(appDelegate);
375 [lifeCycleProvider addApplicationLifecycleDelegate:delegate];
376 [_flutterEngine.pluginAppDelegates addPointer:(__bridge void*)delegate];
377 }
378}

◆ addMethodCallDelegate:channel: [1/2]

- (void) addMethodCallDelegate: (nonnull id< FlutterPlugin >)  delegate
channel: (nonnull FlutterMethodChannel *)  channel 
implementation

Registers |delegate| to receive handleMethodCall:result: callbacks for the given |channel|.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 323 of file FlutterEngine.mm.

363 :(nonnull id<FlutterPlugin>)delegate
364 channel:(nonnull FlutterMethodChannel*)channel {
365 [channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
366 [delegate handleMethodCall:call result:result];
367 }];
368}

◆ addMethodCallDelegate:channel: [2/2]

- (void) addMethodCallDelegate: (NSObject< FlutterPlugin > *)  delegate
channel: (FlutterMethodChannel *)  channel 
implementation

Registers the plugin as a receiver of incoming method calls from the Dart side on the specified FlutterMethodChannel.

Parameters
delegateThe receiving object, such as the plugin's main class.
channelThe channel

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 822 of file FlutterEngine.mm.

1526 :(NSObject<FlutterPlugin>*)delegate
1527 channel:(FlutterMethodChannel*)channel {
1528 [channel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
1529 [delegate handleMethodCall:call result:result];
1530 }];
1531}
void setMethodCallHandler:(FlutterMethodCallHandler _Nullable handler)

◆ dealloc

- (void) dealloc
implementation

Definition at line 822 of file FlutterEngine.mm.

1509 {
1510 [_pluginKey release];
1511 [super dealloc];
1512}

◆ initWithPlugin:flutterEngine: [1/2]

- (instancetype) initWithPlugin: (nonnull NSString *)  pluginKey
flutterEngine: (nonnull FlutterEngine *)  flutterEngine 

◆ initWithPlugin:flutterEngine: [2/2]

- (instancetype) initWithPlugin: (NSString*)  pluginKey
flutterEngine: (FlutterEngine*)  flutterEngine 
Initial value:
{
NSString* _pluginKey

Definition at line 822 of file FlutterEngine.mm.

1501 :(NSString*)pluginKey flutterEngine:(FlutterEngine*)flutterEngine {
1502 self = [super init];
1503 NSAssert(self, @"Super init cannot be nil");
1504 _pluginKey = [pluginKey copy];
1506 return self;
1507}
FlutterEngine * flutterEngine
__weak FlutterEngine * _flutterEngine

◆ lookupKeyForAsset:

- (NSString *) lookupKeyForAsset: (NSString *)  asset
implementation

Returns the file name for the given asset. The returned file name can be used to access the asset in the application's main bundle.

Parameters
assetThe name of the asset. The name can be hierarchical.
Returns
the file name to be used for lookup in the main bundle.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 822 of file FlutterEngine.mm.

1543 :(NSString*)asset {
1544 return [_flutterEngine lookupKeyForAsset:asset];
1545}

◆ lookupKeyForAsset:fromPackage:

- (NSString *) lookupKeyForAsset: (NSString *)  asset
fromPackage: (NSString *)  package 
implementation

Returns the file name for the given asset which originates from the specified package. The returned file name can be used to access the asset in the application's main bundle.

Parameters
assetThe name of the asset. The name can be hierarchical.
packageThe name of the package from which the asset originates.
Returns
the file name to be used for lookup in the main bundle.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 822 of file FlutterEngine.mm.

1547 :(NSString*)asset fromPackage:(NSString*)package {
1548 return [_flutterEngine lookupKeyForAsset:asset fromPackage:package];
1549}

◆ messenger

- (id< FlutterBinaryMessenger >) messenger
implementation

The binary messenger used for creating channels to communicate with the Flutter engine.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 822 of file FlutterEngine.mm.

1514 {
1516}
NSObject< FlutterBinaryMessenger > * binaryMessenger

◆ publish:

- (void) publish: (NSObject *)  value
implementation

Publishes a value for external use of the plugin.

Plugins may publish a single value, such as an instance of the plugin's main class, for situations where external control or interaction is needed.

The published value will be available from the FlutterPluginRegistry. Repeated calls overwrite any previous publication.

Parameters
valueThe value to be published.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 822 of file FlutterEngine.mm.

1522 :(NSObject*)value {
1524}
uint8_t value
NSMutableDictionary * pluginPublications

◆ registerViewFactory:withId: [1/2]

- (void) registerViewFactory: (nonnull NSObject< FlutterPlatformViewFactory > *)  factory
withId: (nonnull NSString *)  factoryId 
implementation

Registers a FlutterPlatformViewFactory for creation of platform views.

Plugins expose NSView for embedding in Flutter apps by registering a view factory.

Parameters
factoryThe view factory that will be registered.
factoryIdA unique identifier for the factory, the Dart code of the Flutter app can use this identifier to request creation of a NSView by the registered factory.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 323 of file FlutterEngine.mm.

380 :(nonnull NSObject<FlutterPlatformViewFactory>*)factory
381 withId:(nonnull NSString*)factoryId {
382 [[_flutterEngine platformViewController] registerViewFactory:factory withId:factoryId];
383}

◆ registerViewFactory:withId: [2/2]

- (void) registerViewFactory: (NSObject< FlutterPlatformViewFactory > *)  factory
withId: (NSString *)  factoryId 
implementation

Registers a FlutterPlatformViewFactory for creation of platform views.

Plugins expose UIView for embedding in Flutter apps by registering a view factory.

Parameters
factoryThe view factory that will be registered.
factoryIdA unique identifier for the factory, the Dart code of the Flutter app can use this identifier to request creation of a UIView by the registered factory.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 822 of file FlutterEngine.mm.

1551 :(NSObject<FlutterPlatformViewFactory>*)factory
1552 withId:(NSString*)factoryId {
1553 [self registerViewFactory:factory
1554 withId:factoryId
1555 gestureRecognizersBlockingPolicy:FlutterPlatformViewGestureRecognizersBlockingPolicyEager];
1556}

◆ registerViewFactory:withId:gestureRecognizersBlockingPolicy:

- (void) registerViewFactory: (NSObject< FlutterPlatformViewFactory > *)  factory
withId: (NSString *)  factoryId
gestureRecognizersBlockingPolicy: (FlutterPlatformViewGestureRecognizersBlockingPolicy gestureRecognizersBlockingPolicy 
implementation

Registers a FlutterPlatformViewFactory for creation of platform views.

Plugins can expose a UIView for embedding in Flutter apps by registering a view factory.

Parameters
factoryThe view factory that will be registered.
factoryIdA unique identifier for the factory, the Dart code of the Flutter app can use this identifier to request creation of a UIView by the registered factory.
gestureRecognizersBlockingPolicyHow UIGestureRecognizers on the platform views are blocked.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 822 of file FlutterEngine.mm.

1558 :(NSObject<FlutterPlatformViewFactory>*)factory
1559 withId:(NSString*)factoryId
1560 gestureRecognizersBlockingPolicy:
1561 (FlutterPlatformViewGestureRecognizersBlockingPolicy)gestureRecognizersBlockingPolicy {
1562 [_flutterEngine platformViewsController]->RegisterViewFactory(factory, factoryId,
1563 gestureRecognizersBlockingPolicy);
1564}
FlutterPlatformViewGestureRecognizersBlockingPolicy

◆ textures

- (id< FlutterTextureRegistry >) textures
implementation

Returns a FlutterTextureRegistry for registering textures provided by the plugin.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 822 of file FlutterEngine.mm.

1518 {
1520}
NSObject< FlutterTextureRegistry > * textureRegistry

◆ view

- (NSView *) view
implementation

The view displaying Flutter content.

This property is provided for backwards compatibility for apps that assume a single view. This will eventually be replaced by a multi-view API variant.

This method may return |nil|, for instance in a headless environment.

Reimplemented from <FlutterPluginRegistrar>.

Definition at line 323 of file FlutterEngine.mm.

348 {
349 return [self viewForIdentifier:kFlutterImplicitViewId];
350}

◆ viewForIdentifier:

- (NSView *) viewForIdentifier: (FlutterViewIdentifier viewIdentifier

Definition at line 323 of file FlutterEngine.mm.

352 :(FlutterViewIdentifier)viewIdentifier {
353 FlutterViewController* controller = [_flutterEngine viewControllerForIdentifier:viewIdentifier];
354 if (controller == nil) {
355 return nil;
356 }
357 if (!controller.viewLoaded) {
358 [controller loadView];
359 }
360 return controller.flutterView;
361}
int64_t FlutterViewIdentifier

Property Documentation

◆ flutterEngine

- (FlutterEngine*) flutterEngine
readwritenonatomicassign

Definition at line 90 of file FlutterEngine.mm.

◆ publishedValue

- (NSObject*) publishedValue
readnonatomicassign

The value published by this plugin, or NSNull if nothing has been published.

The unusual NSNull is for the documented behavior of valuePublishedByPlugin:.

Definition at line 318 of file FlutterEngine.mm.


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