Flutter Engine
 
Loading...
Searching...
No Matches
<FlutterPluginRegistrar> Protocol Reference

#include <FlutterPlugin.h>

Inheritance diagram for <FlutterPluginRegistrar>:
<FlutterBaseRegistrar> FakePluginRegistrar FlutterEnginePluginRegistrar FlutterEngineRegistrar

Instance Methods

(void) - publish:
 
(void) - addMethodCallDelegate:channel:
 
(void) - addApplicationDelegate:
 
(void) - addSceneDelegate:
 
(NSString *) - lookupKeyForAsset:
 
(NSString *) - lookupKeyForAsset:fromPackage:
 
(void) - addMethodCallDelegate:channel:
 
(void) - addApplicationDelegate:
 
(void) - registerViewFactory:withId:
 
(void) - publish:
 
(nonnull NSString *) - lookupKeyForAsset:
 
(nonnull NSString *) - lookupKeyForAsset:fromPackage:
 
- Instance Methods inherited from <FlutterBaseRegistrar>
(NSObject< FlutterBinaryMessenger > *) - messenger
 
(NSObject< FlutterTextureRegistry > *) - textures
 
(void) - registerViewFactory:withId:
 
(void) - registerViewFactory:withId:gestureRecognizersBlockingPolicy:
 

Properties

UIViewController * viewController
 
id< FlutterBinaryMessengermessenger
 
id< FlutterTextureRegistrytextures
 
NSView * view
 
NSViewController * viewController
 

Detailed Description

Registration context for a single FlutterPlugin, providing a one stop shop for the plugin to access contextual information and register callbacks for various application events.

Registrars are obtained from a FlutterPluginRegistry which keeps track of the identity of registered plugins and provides basic support for cross-plugin coordination.

The protocol for an object managing registration for a plugin. It provides access to application context, as allowing registering for callbacks for handling various conditions.

Currently the macOS PluginRegistrar has very limited functionality, but is expected to expand over time to more closely match the functionality of FlutterPluginRegistrar.

Definition at line 349 of file FlutterPlugin.h.

Method Documentation

◆ addApplicationDelegate: [1/2]

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

Registers the plugin as a receiver of UIApplicationDelegate calls.

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

◆ addApplicationDelegate: [2/2]

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

Registers the plugin as a receiver of NSApplicationDelegate calls.

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

◆ addMethodCallDelegate:channel: [1/2]

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

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

◆ addMethodCallDelegate:channel: [2/2]

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

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

◆ addSceneDelegate:

- (void) addSceneDelegate: (ios(13.0))  API_AVAILABLE

Registers the plugin as a receiver of UISceneDelegate and UIWindowSceneDelegate calls.

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

◆ lookupKeyForAsset: [1/2]

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

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.

◆ lookupKeyForAsset: [2/2]

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

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.

◆ lookupKeyForAsset:fromPackage: [1/2]

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

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.

◆ lookupKeyForAsset:fromPackage: [2/2]

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

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.

◆ publish: [1/2]

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

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.

◆ publish: [2/2]

- (void) publish: (NSObject *)  value

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.

◆ registerViewFactory:withId:

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

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.

Property Documentation

◆ messenger

- (id<FlutterBinaryMessenger>) messenger
readatomicassign

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

Definition at line 33 of file FlutterPluginRegistrarMacOS.h.

◆ textures

- (id<FlutterTextureRegistry>) textures
readatomicassign

Returns a FlutterTextureRegistry for registering textures provided by the plugin.

Definition at line 39 of file FlutterPluginRegistrarMacOS.h.

◆ view

- (NSView*) view
readatomicassign

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.

Definition at line 50 of file FlutterPluginRegistrarMacOS.h.

◆ viewController [1/2]

- (UIViewController*) viewController
readatomicassign

The UIViewController whose view is displaying Flutter content.

The plugin typically should not store a strong reference to this view controller.

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

This property may be |nil|, for instance in a headless environment, or when the underlying Flutter engine is deallocated.

Definition at line 363 of file FlutterPlugin.h.

◆ viewController [2/2]

- (NSViewController*) viewController
readatomicassign

The NSViewController that hosts |view|.

The plugin typically should not store a strong reference to this view controller.

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

This property is |nil| when |view| is |nil|.

Definition at line 63 of file FlutterPluginRegistrarMacOS.h.


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