FlutterPluginRegistrar
@protocol FlutterPluginRegistrar <NSObject>
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.
-
Returns a
FlutterBinaryMessengerfor creating Dart/iOS communication channels to be used by the plugin.Declaration
Objective-C
- (nonnull NSObject<FlutterBinaryMessenger> *)messenger;Return Value
The messenger.
-
Returns a
FlutterTextureRegistryfor registering textures provided by the plugin.Declaration
Objective-C
- (nonnull NSObject<FlutterTextureRegistry> *)textures;Return Value
The texture registry.
-
Registers a
FlutterPlatformViewFactoryfor creation of platform views.Plugins expose
UIViewfor embedding in Flutter apps by registering a view factory.Declaration
Objective-C
- (void)registerViewFactory: (nonnull NSObject<FlutterPlatformViewFactory> *)factory withId:(nonnull NSString *)factoryId;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
UIViewby the registered factory. -
Registers a
FlutterPlatformViewFactoryfor creation of platform views.Plugins can expose a
UIViewfor embedding in Flutter apps by registering a view factory.Declaration
Objective-C
- (void)registerViewFactory: (nonnull NSObject<FlutterPlatformViewFactory> *)factory withId:(nonnull NSString *)factoryId gestureRecognizersBlockingPolicy: (FlutterPlatformViewGestureRecognizersBlockingPolicy) gestureRecognizersBlockingPolicy;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
UIViewby the registered factory.gestureRecognizersBlockingPolicyHow UIGestureRecognizers on the platform views are blocked.
-
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.Declaration
Objective-C
- (void)publish:(nonnull NSObject *)value;Parameters
valueThe value to be published.
-
Registers the plugin as a receiver of incoming method calls from the Dart side on the specified
FlutterMethodChannel.Declaration
Objective-C
- (void)addMethodCallDelegate:(nonnull NSObject<FlutterPlugin> *)delegate channel:(nonnull FlutterMethodChannel *)channel;Parameters
delegateThe receiving object, such as the plugin’s main class.
channelThe channel
-
Registers the plugin as a receiver of
UIApplicationDelegatecalls.Declaration
Objective-C
- (void)addApplicationDelegate:(nonnull NSObject<FlutterPlugin> *)delegate;Parameters
delegateThe receiving object, such as the plugin’s main class.
-
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.
Declaration
Objective-C
- (nonnull NSString *)lookupKeyForAsset:(nonnull NSString *)asset;Parameters
assetThe name of the asset. The name can be hierarchical.
Return Value
the file name to be used for lookup in the main bundle.
-
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.
Declaration
Objective-C
- (nonnull NSString *)lookupKeyForAsset:(nonnull NSString *)asset fromPackage:(nonnull NSString *)package;Parameters
assetThe name of the asset. The name can be hierarchical.
packageThe name of the package from which the asset originates.
Return Value
the file name to be used for lookup in the main bundle.
View on GitHub
Install in Dash
FlutterPluginRegistrar Protocol Reference