Classes

The following classes are available globally.

  • UIApplicationDelegate subclass for simple apps that want default behavior.

    This class implements the following behaviors:

    • Status bar touches are forwarded to the key window’s root view FlutterViewController, in order to trigger scroll to top.
    • Keeps the Flutter connection open in debug mode when the phone screen locks.

    App delegates for Flutter applications are not required to inherit from this class. Developers of custom app delegate classes should copy and paste code as necessary from FlutterAppDelegate.mm.

    See more

    Declaration

    Objective-C

    @interface FlutterAppDelegate
        : UIResponder <UIApplicationDelegate, FlutterPluginRegistry,
                       FlutterAppLifeCycleProvider>
  • An object containing the result of FlutterCallbackCache‘s lookupCallbackInformation method.

    See more

    Declaration

    Objective-C

    @interface FlutterCallbackInformation : NSObject
  • The cache containing callback information for spawning a FlutterHeadlessDartRunner.

    See more

    Declaration

    Objective-C

    @interface FlutterCallbackCache : NSObject
  • A channel for communicating with the Flutter side using basic, asynchronous message passing.

    See more

    Declaration

    Objective-C

    @interface FlutterBasicMessageChannel : NSObject
  • A channel for communicating with the Flutter side using invocation of asynchronous methods.

    See more

    Declaration

    Objective-C

    @interface FlutterMethodChannel : NSObject
  • A channel for communicating with the Flutter side using event streams.

    See more

    Declaration

    Objective-C

    @interface FlutterEventChannel : NSObject
  • A FlutterMessageCodec using unencoded binary messages, represented as NSData instances.

    This codec is guaranteed to be compatible with the corresponding BinaryCodec on the Dart side. These parts of the Flutter SDK are evolved synchronously.

    On the Dart side, messages are represented using ByteData.

    Declaration

    Objective-C

    @interface FlutterBinaryCodec : NSObject <FlutterMessageCodec>
  • A FlutterMessageCodec using UTF-8 encoded NSString messages.

    This codec is guaranteed to be compatible with the corresponding StringCodec on the Dart side. These parts of the Flutter SDK are evolved synchronously.

    Declaration

    Objective-C

    @interface FlutterStringCodec : NSObject <FlutterMessageCodec>
  • A FlutterMessageCodec using UTF-8 encoded JSON messages.

    This codec is guaranteed to be compatible with the corresponding JSONMessageCodec on the Dart side. These parts of the Flutter SDK are evolved synchronously.

    Supports values accepted by NSJSONSerialization plus top-level nil, NSNumber, and NSString.

    On the Dart side, JSON messages are handled by the JSON facilities of the dart:convert package.

    Declaration

    Objective-C

    @interface FlutterJSONMessageCodec : NSObject <FlutterMessageCodec>
  • A writer of the Flutter standard binary encoding.

    See FlutterStandardMessageCodec for details on the encoding.

    The encoding is extensible via subclasses overriding writeValue.

    See more

    Declaration

    Objective-C

    @interface FlutterStandardWriter : NSObject
  • A reader of the Flutter standard binary encoding.

    See FlutterStandardMessageCodec for details on the encoding.

    The encoding is extensible via subclasses overriding readValueOfType.

    See more

    Declaration

    Objective-C

    @interface FlutterStandardReader : NSObject
  • A factory of compatible reader/writer instances using the Flutter standard binary encoding or extensions thereof.

    See more

    Declaration

    Objective-C

    @interface FlutterStandardReaderWriter : NSObject
  • A FlutterMessageCodec using the Flutter standard binary encoding.

    This codec is guaranteed to be compatible with the corresponding StandardMessageCodec on the Dart side. These parts of the Flutter SDK are evolved synchronously.

    Supported messages are acyclic values of these forms:

    • nil or NSNull
    • NSNumber (including their representation of Boolean values)
    • NSString
    • FlutterStandardTypedData
    • NSArray of supported values
    • NSDictionary with supported keys and values

    On the Dart side, these values are represented as follows:

    • nil or NSNull: null
    • NSNumber: bool, int, or double, depending on the contained value.
    • NSString: String
    • FlutterStandardTypedData: Uint8List, Int32List, Int64List, or Float64List
    • NSArray: List
    • NSDictionary: Map
    See more

    Declaration

    Objective-C

    @interface FlutterStandardMessageCodec : NSObject <FlutterMessageCodec>
  • Command object representing a method call on a FlutterMethodChannel.

    See more

    Declaration

    Objective-C

    @interface FlutterMethodCall : NSObject
  • Error object representing an unsuccessful outcome of invoking a method on a FlutterMethodChannel, or an error event on a FlutterEventChannel.

    See more

    Declaration

    Objective-C

    @interface FlutterError : NSObject
  • A byte buffer holding UInt8, SInt32, SInt64, or Float64 values, used with FlutterStandardMessageCodec and FlutterStandardMethodCodec.

    Two’s complement encoding is used for signed integers. IEEE754 double-precision representation is used for floats. The platform’s native endianness is assumed.

    See more

    Declaration

    Objective-C

    @interface FlutterStandardTypedData : NSObject
  • Unavailable

    Unavailable on 2018-08-31. Deprecated on 2018-01-09. FlutterStandardBigInteger was needed because the Dart 1.0 int type had no size limit. With Dart 2.0, the int type is a fixed-size, 64-bit signed integer. If you need to communicate larger integers, use NSString encoding instead.

    An arbitrarily large integer value, used with FlutterStandardMessageCodec and FlutterStandardMethodCodec.

    Declaration

    Objective-C

    
    @interface FlutterStandardBigInteger : NSObject
  • A FlutterMethodCodec using UTF-8 encoded JSON method calls and result envelopes.

    This codec is guaranteed to be compatible with the corresponding JSONMethodCodec on the Dart side. These parts of the Flutter SDK are evolved synchronously.

    Values supported as methods arguments and result payloads are those supported as top-level or leaf values by FlutterJSONMessageCodec.

    Declaration

    Objective-C

    @interface FlutterJSONMethodCodec : NSObject <FlutterMethodCodec>
  • A FlutterMethodCodec using the Flutter standard binary encoding.

    This codec is guaranteed to be compatible with the corresponding StandardMethodCodec on the Dart side. These parts of the Flutter SDK are evolved synchronously.

    Values supported as method arguments and result payloads are those supported by FlutterStandardMessageCodec.

    See more

    Declaration

    Objective-C

    @interface FlutterStandardMethodCodec : NSObject <FlutterMethodCodec>
  • A set of Flutter and Dart assets used by a FlutterEngine to initialize execution.

    See more

    Declaration

    Objective-C

    @interface FlutterDartProject : NSObject
  • The FlutterEngine class coordinates a single instance of execution for a FlutterDartProject. It may have zero or one FlutterViewController at a time, which can be specified via -setViewController:. FlutterViewController‘s initWithEngine initializer will automatically call -setViewController: for itself.

    A FlutterEngine can be created independently of a FlutterViewController for headless execution. It can also persist across the lifespan of multiple FlutterViewController instances to maintain state and/or asynchronous tasks (such as downloading a large file).

    A FlutterEngine can also be used to prewarm the Dart execution environment and reduce the latency of showing the Flutter screen when a FlutterViewController is created and presented. See http://flutter.dev/docs/development/add-to-app/performance for more details on loading performance.

    Alternatively, you can simply create a new FlutterViewController with only a FlutterDartProject. That FlutterViewController will internally manage its own instance of a FlutterEngine, but will not guarantee survival of the engine beyond the life of the ViewController.

    A newly initialized FlutterEngine will not actually run a Dart Isolate until either -runWithEntrypoint: or -runWithEntrypoint:libraryURI is invoked. One of these methods must be invoked before calling -setViewController:.

    See more

    Declaration

    Objective-C

    @interface FlutterEngine
        : NSObject <FlutterTextureRegistry, FlutterPluginRegistry>
  • Options that control how a FlutterEngine should be created.

    See more

    Declaration

    Objective-C

    @interface FlutterEngineGroupOptions : NSObject
  • Represents a collection of FlutterEngines who share resources which allows them to be created with less time const and occupy less memory than just creating multiple FlutterEngines.

    Deleting a FlutterEngineGroup doesn’t invalidate existing FlutterEngines, but it eliminates the possibility to create more FlutterEngines in that group.

    Warning

    This class is a work-in-progress and may change.
    See more

    Declaration

    Objective-C

    @interface FlutterEngineGroup : NSObject
  • Deprecated

    FlutterEngine should be used rather than FlutterHeadlessDartRunner

    The deprecated FlutterHeadlessDartRunner runs Flutter Dart code with a null rasterizer, and no native drawing surface. It is appropriate for use in running Dart code e.g. in the background from a plugin.

    Most callers should prefer using FlutterEngine directly; this interface exists for legacy support.

    See more

    Declaration

    Objective-C

    
    @interface FlutterHeadlessDartRunner : FlutterEngine
  • Propagates UIAppDelegate callbacks to registered plugins.

    See more

    Declaration

    Objective-C

    @interface FlutterPluginAppLifeCycleDelegate
        : NSObject <UNUserNotificationCenterDelegate>
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface FlutterViewController
        : UIViewController <FlutterTextureRegistry, FlutterPluginRegistry, UIGestureRecognizerDelegate>
    #else
    @interface FlutterViewController : UIViewController <FlutterTextureRegistry, FlutterPluginRegistry>
    #endif
    
    /**
     * Initializes this FlutterViewController with the specified `FlutterEngine`.
     *
     * The initialized viewcontroller will attach itself to the engine as part of this process.
     *
     * @param engine The `FlutterEngine` instance to attach to. Cannot be nil.
     * @param nibName The NIB name to initialize this UIViewController with.
     * @param nibBundle The NIB bundle.
     */
    - (instancetype)initWithEngine:(FlutterEngine*)engine
                           nibName:(nullable NSString*)nibName
                            bundle:(nullable NSBundle*)nibBundle NS_DESIGNATED_INITIALIZER;
    
    /**
     * Initializes a new FlutterViewController and `FlutterEngine` with the specified
     * `FlutterDartProject`.
     *
     * This will implicitly create a new `FlutterEngine` which is retrievable via the `engine` property
     * after initialization.
     *
     * @param project The `FlutterDartProject` to initialize the `FlutterEngine` with.
     * @param nibName The NIB name to initialize this UIViewController with.
     * @param nibBundle The NIB bundle.
     */
    - (instancetype)initWithProject:(nullable FlutterDartProject*)project
                            nibName:(nullable NSString*)nibName
                             bundle:(nullable NSBundle*)nibBundle NS_DESIGNATED_INITIALIZER;
    
    /**
     * Initializes a new FlutterViewController and `FlutterEngine` with the specified
     * `FlutterDartProject` and `initialRoute`.
     *
     * This will implicitly create a new `FlutterEngine` which is retrievable via the `engine` property
     * after initialization.
     *
     * @param project The `FlutterDartProject` to initialize the `FlutterEngine` with.
     * @param initialRoute The initial `Navigator` route to load.
     * @param nibName The NIB name to initialize this UIViewController with.
     * @param nibBundle The NIB bundle.
     */
    - (instancetype)initWithProject:(nullable FlutterDartProject*)project
                       initialRoute:(nullable NSString*)initialRoute
                            nibName:(nullable NSString*)nibName
                             bundle:(nullable NSBundle*)nibBundle NS_DESIGNATED_INITIALIZER;
    
    /**
     * Initializer that is called from loading a FlutterViewController from a XIB.
     *
     * See also:
     * https://developer.apple.com/documentation/foundation/nscoding/1416145-initwithcoder?language=objc
     */
    - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_DESIGNATED_INITIALIZER;
    
    /**
     * Registers a callback that will be invoked when the Flutter view has been rendered.
     * The callback will be fired only once.
     *
     * Replaces an existing callback. Use a `nil` callback to unregister the existing one.
     */
    - (void)setFlutterViewDidRenderCallback:(void (^)(void))callback;
    
    /**
     * 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.
     *
     * @param asset The name of the asset. The name can be hierarchical.
     * @return The file name to be used for lookup in the main bundle.
     */
    - (NSString*)lookupKeyForAsset:(NSString*)asset;
    
    /**
     * 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.
     *
     * @param asset The name of the asset. The name can be hierarchical.
     * @param package The name of the package from which the asset originates.
     * @return The file name to be used for lookup in the main bundle.
     */
    - (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package;
    
    /**
     * Deprecated API to set initial route.
     *
     * Attempts to set the first route that the Flutter app shows if the Flutter
     * runtime hasn't yet started. The default is "/".
     *
     * This method must be called immediately after `initWithProject` and has no
     * effect when using `initWithEngine` if the `FlutterEngine` has already been
     * run.
     *
     * Setting this after the Flutter started running has no effect. See `pushRoute`
     * and `popRoute` to change the route after Flutter started running.
     *
     * This is deprecated because it needs to be called at the time of initialization
     * and thus should just be in the `initWithProject` initializer. If using
     * `initWithEngine`, the initial route should be set on the engine's
     * initializer.
     *
     * @param route The name of the first route to show.
     */
    - (void)setInitialRoute:(NSString*)route
        FLUTTER_DEPRECATED("Use FlutterViewController initializer to specify initial route");
    
    /**
     * Instructs the Flutter Navigator (if any) to go back.
     */
    - (void)popRoute;
    
    /**
     * Instructs the Flutter Navigator (if any) to push a route on to the navigation
     * stack.
     *
     * @param route The name of the route to push to the navigation stack.
     */
    - (void)pushRoute:(NSString*)route;
    
    /**
     * The `FlutterPluginRegistry` used by this FlutterViewController.
     */
    - (id<FlutterPluginRegistry>)pluginRegistry;
    
    /**
     * A wrapper around UIAccessibilityIsVoiceOverRunning().
     *
     * As a C function, UIAccessibilityIsVoiceOverRunning() cannot be mocked in testing. Mock
     * this class method to testing features depends on UIAccessibilityIsVoiceOverRunning().
     */
    + (BOOL)isUIAccessibilityIsVoiceOverRunning;
    
    /**
     * True if at least one frame has rendered and the ViewController has appeared.
     *
     * This property is reset to false when the ViewController disappears. It is
     * guaranteed to only alternate between true and false for observers.
     */
    @property(nonatomic, readonly, getter=isDisplayingFlutterUI) BOOL displayingFlutterUI;
    
    /**
     * Specifies the view to use as a splash screen. Flutter's rendering is asynchronous, so the first
     * frame rendered by the Flutter application might not immediately appear when the Flutter view is
     * initially placed in the view hierarchy. The splash screen view will be used as
     * a replacement until the first frame is rendered.
     *
     * The view used should be appropriate for multiple sizes; an autoresizing mask to
     * have a flexible width and height will be applied automatically.
     *
     * Set to nil to remove the splash screen view.
     */
    @property(strong, nonatomic, nullable) UIView* splashScreenView;
    
    /**
     * Attempts to set the `splashScreenView` property from the `UILaunchStoryboardName` from the
     * main bundle's `Info.plist` file.  This method will not change the value of `splashScreenView`
     * if it cannot find a default one from a storyboard or nib.
     *
     * @return `YES` if successful, `NO` otherwise.
     */
    - (BOOL)loadDefaultSplashScreenView;
    
    /**
     * Controls whether the created view will be opaque or not.
     *
     * Default is `YES`.  Note that setting this to `NO` may negatively impact performance
     * when using hardware acceleration, and toggling this will trigger a re-layout of the
     * view.
     */
    @property(nonatomic, getter=isViewOpaque) BOOL viewOpaque;
    
    /**
     * The `FlutterEngine` instance for this view controller. This could be the engine this
     * `FlutterViewController` is initialized with or a new `FlutterEngine` implicitly created if
     * no engine was supplied during initialization.
     */
    @property(weak, nonatomic, readonly) FlutterEngine* engine;
    
    /**
     * The `FlutterBinaryMessenger` associated with this FlutterViewController (used for communicating
     * with channels).
     *
     * This is just a convenient way to get the |FlutterEngine|'s binary messenger.
     */
    @property(nonatomic, readonly) NSObject<FlutterBinaryMessenger>* binaryMessenger;
    
    /**
     * If the `FlutterViewController` creates a `FlutterEngine`, this property
     * determines if that `FlutterEngine` has `allowHeadlessExecution` set.
     *
     * The intention is that this is used with the XIB.  Otherwise, a
     * `FlutterEngine` can just be sent to the init methods.
     *
     * See also: `-[FlutterEngine initWithName:project:allowHeadlessExecution:]`
     */
    @property(nonatomic, readonly) BOOL engineAllowHeadlessExecution;
    
    @end