Flutter Engine
The Flutter Engine
FlutterPlatformViews.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_HEADERS_FLUTTERPLATFORMVIEWS_H_
6#define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_HEADERS_FLUTTERPLATFORMVIEWS_H_
7
8#import <AppKit/AppKit.h>
9
10#import "FlutterCodecs.h"
11#import "FlutterMacros.h"
12
13@protocol FlutterPlatformViewFactory <NSObject>
14
15/**
16 * Create a Platform View which is an `NSView`.
17 *
18 * A MacOS plugin should implement this method and return an `NSView`, which can be embedded in a
19 * Flutter App.
20 *
21 * The implementation of this method should create a new `NSView`.
22 *
23 * @param viewId A unique identifier for this view.
24 * @param args Parameters for creating the view sent from the Dart side of the
25 * Flutter app. If `createArgsCodec` is not implemented, or if no creation arguments were sent from
26 * the Dart code, this will be null. Otherwise this will be the value sent from the Dart code as
27 * decoded by `createArgsCodec`.
28 */
29- (nonnull NSView*)createWithViewIdentifier:(int64_t)viewId arguments:(nullable id)args;
30
31/**
32 * Returns the `FlutterMessageCodec` for decoding the args parameter of `createWithFrame`.
33 *
34 * Only implement this if `createWithFrame` needs an arguments parameter.
35 */
36@optional
37- (nullable NSObject<FlutterMessageCodec>*)createArgsCodec;
38@end
39
40#endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_HEADERS_FLUTTERPLATFORMVIEWS_H_
HWND(* FlutterPlatformViewFactory)(const FlutterPlatformViewCreationParameters *)