FlutterPlugin
@protocol FlutterPlugin <NSObject>
Implemented by the iOS part of a Flutter plugin.
Defines a set of optional callback methods and a method to set up the plugin and register it to be called by other application components.
-
Registers this plugin using the context information and callback registration methods exposed by the given registrar.
The registrar is obtained from a
FlutterPluginRegistry
which keeps track of the identity of registered plugins and provides basic support for cross-plugin coordination.The caller of this method, a plugin registrant, is usually autogenerated by Flutter tooling based on declared plugin dependencies. The generated registrant asks the registry for a registrar for each plugin, and calls this method to allow the plugin to initialize itself and register callbacks with application objects available through the registrar protocol.
Declaration
Objective-C
+ (void)registerWithRegistrar: (nonnull NSObject<FlutterPluginRegistrar> *)registrar;
Parameters
registrar
A helper providing application context and methods for registering callbacks.
-
Set a callback for registering plugins to an additional
FlutterPluginRegistry
, including headlessFlutterEngine
instances.This method is typically called from within an application’s
AppDelegate
at startup to allow for plugins which create additionalFlutterEngine
instances to register the application’s plugins.Declaration
Objective-C
+ (void)setPluginRegistrantCallback: (nonnull FlutterPluginRegistrantCallback)callback;
Parameters
callback
A callback for registering some set of plugins with a
FlutterPluginRegistry
. -
Called if this plugin has been registered to receive
FlutterMethodCall
s.Declaration
Objective-C
- (void)handleMethodCall:(nonnull FlutterMethodCall *)call result:(nonnull FlutterResult)result;
Parameters
call
The method call command object.
result
A callback for submitting the result of the call.
-
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (BOOL)application:(nonnull UIApplication *)application didFinishLaunchingWithOptions:(nonnull NSDictionary *)launchOptions;
Return Value
NO
if this plugin vetoes application launch. -
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (BOOL)application:(nonnull UIApplication *)application willFinishLaunchingWithOptions:(nonnull NSDictionary *)launchOptions;
Return Value
NO
if this plugin vetoes application launch. -
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (void)applicationDidBecomeActive:(nonnull UIApplication *)application;
-
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (void)applicationWillResignActive:(nonnull UIApplication *)application;
-
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (void)applicationDidEnterBackground:(nonnull UIApplication *)application;
-
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (void)applicationWillEnterForeground:(nonnull UIApplication *)application;
-
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (void)applicationWillTerminate:(nonnull UIApplication *)application;
-
Undocumented
Declaration
Objective-C
- (void)application:(UIApplication*)application didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings;
-
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (void)application:(nonnull UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken: (nonnull NSData *)deviceToken;
-
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (BOOL)application:(nonnull UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler: (nonnull void (^)(UIBackgroundFetchResult))completionHandler;
Return Value
YES
if this plugin handles the request. -
Calls all plugins registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (void)application:(nonnull UIApplication *)application didReceiveLocalNotification:(nonnull UILocalNotification *)notification;
-
Calls all plugins registered for
UNUserNotificationCenterDelegate
callbacks.Declaration
Objective-C
- (void)userNotificationCenter:(nonnull UNUserNotificationCenter *)center willPresentNotification:(nonnull UNNotification *)notification withCompletionHandler: (nonnull void (^)(UNNotificationPresentationOptions)) completionHandler;
-
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (BOOL)application:(nonnull UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary<UIApplicationOpenURLOptionsKey, id> *) options;
Return Value
YES
if this plugin handles the request. -
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (BOOL)application:(nonnull UIApplication *)application handleOpenURL:(nonnull NSURL *)url;
Return Value
YES
if this plugin handles the request. -
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (BOOL)application:(nonnull UIApplication *)application openURL:(nonnull NSURL *)url sourceApplication:(nonnull NSString *)sourceApplication annotation:(nonnull id)annotation;
Return Value
YES
if this plugin handles the request. -
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (BOOL)application:(nonnull UIApplication *)application performActionForShortcutItem: (nonnull UIApplicationShortcutItem *)shortcutItem completionHandler:(nonnull void (^)(BOOL))completionHandler;
Return Value
YES
if this plugin handles the request. -
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (BOOL)application:(nonnull UIApplication *)application handleEventsForBackgroundURLSession:(nonnull NSString *)identifier completionHandler: (nonnull void (^)(void))completionHandler;
Return Value
YES
if this plugin handles the request. -
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (BOOL)application:(nonnull UIApplication *)application performFetchWithCompletionHandler: (nonnull void (^)(UIBackgroundFetchResult))completionHandler;
Return Value
YES
if this plugin handles the request. -
Called if this plugin has been registered for
UIApplicationDelegate
callbacks.Declaration
Objective-C
- (BOOL)application:(nonnull UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler: (nonnull void (^)(NSArray *_Nonnull))restorationHandler;
Return Value
YES
if this plugin handles the request.