Protocols

The following protocols are available globally.

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

    See more

    Declaration

    Objective-C

    @protocol FlutterStreamHandler
  • A message encoding/decoding mechanism.

    See more

    Declaration

    Objective-C

    @protocol FlutterMessageCodec
  • 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
  • Wraps a UIView for embedding in the Flutter hierarchy

    See more

    Declaration

    Objective-C

    @protocol FlutterPlatformView <NSObject>
  • 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` measued 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

  • 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>

  • 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>

  • 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>

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

    See more

    Declaration

    Objective-C

    @protocol FlutterAppLifeCycleProvider
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol FlutterTexture <NSObject>
    - (CVPixelBufferRef _Nullable)copyPixelBuffer;
    @end
  • Undocumented

    See more

    Declaration

    Objective-C

    @protocol FlutterTextureRegistry <NSObject>
    - (int64_t)registerTexture:(NSObject<FlutterTexture>*)texture;
    - (void)textureFrameAvailable:(int64_t)textureId;
    - (void)unregisterTexture:(int64_t)textureId;
    @end