| Flutter macOS Embedder |

FlutterPlatformViewController.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_SOURCE_FLUTTERPLATFORMVIEWCONTROLLER_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWCONTROLLER_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #import "FlutterChannels.h"
11
12 #import "flutter/shell/platform/darwin/macos/framework/Headers/FlutterPlatformViews.h"
13
14 #include <map>
15 #include <unordered_set>
16
17 @interface FlutterPlatformViewController : NSViewController
18 @end
19
20 @interface FlutterPlatformViewController ()
21
22 /**
23 * Creates a platform view of viewType with viewId and arguments passed from
24 * the framework's creationParams constructor parameter.
25 * FlutterResult is updated to contain nil for success or to contain
26 * a FlutterError if there is an error.
27 */
28 - (void)onCreateWithViewIdentifier:(int64_t)viewId
29 viewType:(nonnull NSString*)viewType
30 arguments:(nullable id)args
31 result:(nonnull FlutterResult)result;
32
33 /**
34 * Disposes the platform view with `viewId`.
35 * FlutterResult is updated to contain nil for success or a FlutterError if there is an error.
36 */
37 - (void)onDisposeWithViewID:(int64_t)viewId result:(nonnull FlutterResult)result;
38
39 /**
40 * Returns the platform view associated with the viewId.
41 */
42 - (nullable NSView*)platformViewWithID:(int64_t)viewId;
43
44 /**
45 * Register a view factory by adding an entry into the platformViewFactories map with key factoryId
46 * and value factory.
47 */
48 - (void)registerViewFactory:(nonnull NSObject<FlutterPlatformViewFactory>*)factory
49 withId:(nonnull NSString*)factoryId;
50
51 /**
52 * Handles platform view related method calls, for example create, dispose, etc.
53 */
54 - (void)handleMethodCall:(nonnull FlutterMethodCall*)call result:(nonnull FlutterResult)result;
55
56 /**
57 * Removes platform views slated to be disposed via method handler calls.
58 */
59 - (void)disposePlatformViews;
60
61 @end
62
63 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMVIEWCONTROLLER_H_
FlutterChannels.h
FlutterResult
void(^ FlutterResult)(id _Nullable result)
Definition: FlutterChannels.h:194
FlutterPlatformViews.h
FlutterMethodCall
Definition: FlutterCodecs.h:221
FlutterPlatformViewController
Definition: FlutterPlatformViewController.h:18
-[FlutterPlatformViewController disposePlatformViews]
void disposePlatformViews()