# Protocols

The following protocols are available globally.

- `FlutterBinaryMessenger`

  A facility for communicating with the Flutter side using asynchronous message passing with binary messages.

  Implementated by:

  - `FlutterBasicMessageChannel`, which supports communication using structured messages.
  - `FlutterMethodChannel`, which supports communication using asynchronous method calls.
  - `FlutterEventChannel`, which supports commuication using event streams.
  See more

  #### Declaration

  Objective-C

      @protocol FlutterBinaryMessenger <NSObject>

  Swift

      protocol FlutterBinaryMessenger : NSObjectProtocol

- `FlutterStreamHandler`

  A strategy for exposing an event stream to the Flutter side.

  See more

  #### Declaration

  Objective-C

      @protocol FlutterStreamHandler

  Swift

      protocol FlutterStreamHandler

- `FlutterMessageCodec`

  A message encoding/decoding mechanism.

  See more

  #### Declaration

  Objective-C

      @protocol FlutterMessageCodec

  Swift

      protocol FlutterMessageCodec

- `FlutterMethodCodec`

  A codec for method calls and enveloped results.

  Method calls are encoded as binary messages with enough structure that the codec can extract a method name `NSString` and an arguments `NSObject`, possibly `nil`. These data items are used to populate a `FlutterMethodCall`.

  Result envelopes are encoded as binary messages with enough structure that the codec can determine whether the result was successful or an error. In the former case, the codec can extract the result `NSObject`, possibly `nil`. In the latter case, the codec can extract an error code `NSString`, a human-readable `NSString` error message (possibly `nil`), and a custom error details `NSObject`, possibly `nil`. These data items are used to populate a `FlutterError`.

  See more

  #### Declaration

  Objective-C

      @protocol FlutterMethodCodec

  Swift

      protocol FlutterMethodCodec

- `FlutterPlatformView`

  Wraps a `UIView` for embedding in the Flutter hierarchy

  See more

  #### Declaration

  Objective-C

      @protocol FlutterPlatformView <NSObject>

  Swift

      protocol FlutterPlatformView : NSObjectProtocol

- `FlutterPlatformViewFactory`

  Undocumented

  See more

  #### Declaration

  Objective-C

      @protocol FlutterPlatformViewFactory <NSObject>
      /**
       * Create a `FlutterPlatformView`.
       *
       * Implemented by iOS code that expose a `UIView` for embedding in a Flutter app.
       *
       * The implementation of this method should create a new `UIView` and return it.
       *
       * @param frame The rectangle for the newly created `UIView` measured in points.
       * @param viewId A unique identifier for this `UIView`.
       * @param args Parameters for creating the `UIView` sent from the Dart side of the Flutter app.
       *   If `createArgsCodec` is not implemented, or if no creation arguments were sent from the Dart
       *   code, this will be null. Otherwise this will be the value sent from the Dart code as decoded by
       *   `createArgsCodec`.
       */
      - (NSObject<FlutterPlatformView>*)createWithFrame:(CGRect)frame
                                         viewIdentifier:(int64_t)viewId
                                              arguments:(id _Nullable)args;

      /**
       * Returns the `FlutterMessageCodec` for decoding the args parameter of `createWithFrame`.
       *
       * Only needs to be implemented if `createWithFrame` needs an arguments parameter.
       */
      @optional
      - (NSObject<FlutterMessageCodec>*)createArgsCodec;
      @end

  Swift

      protocol FlutterPlatformViewFactory : NSObjectProtocol

- `FlutterApplicationLifeCycleDelegate`

  Protocol for listener of events from the UIApplication, typically a FlutterPlugin.

  See more

  #### Declaration

  Objective-C

      @protocol FlutterApplicationLifeCycleDelegate <UNUserNotificationCenterDelegate>

  Swift

      protocol FlutterApplicationLifeCycleDelegate : UNUserNotificationCenterDelegate

- `FlutterPlugin`

  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.

  See more

  #### Declaration

  Objective-C

      @protocol FlutterPlugin <NSObject, FlutterApplicationLifeCycleDelegate>

  Swift

      protocol FlutterPlugin : FlutterApplicationLifeCycleDelegate

- `FlutterPluginRegistrar`

  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.

  See more

  #### Declaration

  Objective-C

      @protocol FlutterPluginRegistrar <NSObject>

  Swift

      protocol FlutterPluginRegistrar : NSObjectProtocol

- `FlutterPluginRegistry`

  A registry of Flutter iOS plugins.

  Plugins are identified by unique string keys, typically the name of the plugin’s main class. The registry tracks plugins by this key, mapping it to a value published by the plugin during registration, if any. This provides a very basic means of cross-plugin coordination with loose coupling between unrelated plugins.

  Plugins typically need contextual information and the ability to register callbacks for various application events. To keep the API of the registry focused, these facilities are not provided directly by the registry, but by a `FlutterPluginRegistrar`, created by the registry in exchange for the unique key of the plugin.

  There is no implied connection between the registry and the registrar. Specifically, callbacks registered by the plugin via the registrar may be relayed directly to the underlying iOS application objects.

  See more

  #### Declaration

  Objective-C

      @protocol FlutterPluginRegistry <NSObject>

  Swift

      protocol FlutterPluginRegistry : NSObjectProtocol

- `FlutterAppLifeCycleProvider`

  Implement this in the `UIAppDelegate` of your app to enable Flutter plugins to register themselves to the application life cycle events.

  For plugins to receive events from `UNUserNotificationCenter`, register this as the `UNUserNotificationCenterDelegate`.

  See more

  #### Declaration

  Objective-C

      @protocol FlutterAppLifeCycleProvider <UNUserNotificationCenterDelegate>

  Swift

      protocol FlutterAppLifeCycleProvider : UNUserNotificationCenterDelegate

- `FlutterTexture`

  Represents a texture that can be shared with Flutter.

  See also: https://github.com/flutter/plugins/tree/master/packages/camera

  See more

  #### Declaration

  Objective-C

      @protocol FlutterTexture <NSObject>

  Swift

      protocol FlutterTexture : NSObjectProtocol

- `FlutterTextureRegistry`

  A collection of registered `FlutterTexture`‘s.

  See more

  #### Declaration

  Objective-C

      @protocol FlutterTextureRegistry <NSObject>

  Swift

      protocol FlutterTextureRegistry : NSObjectProtocol

© 2023 Flutter. All rights reserved. (Last updated: 2023-02-07)

Generated by jazzy ♪♫ v0.14.3, a Realm project.