| Flutter iOS Embedder |

FlutterEngine_Internal.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_IOS_FRAMEWORK_SOURCE_FLUTTERENGINE_INTERNAL_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERENGINE_INTERNAL_H_
7
8 #import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h"
9
10 #include "flutter/fml/memory/weak_ptr.h"
11 #include "flutter/fml/task_runner.h"
12 #include "flutter/lib/ui/window/pointer_data_packet.h"
13 #include "flutter/lib/ui/window/viewport_metrics.h"
14 #include "flutter/shell/common/platform_view.h"
15 #include "flutter/shell/common/rasterizer.h"
16 #include "flutter/shell/common/shell.h"
17
18 #include "flutter/shell/platform/embedder/embedder.h"
19
20 #import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h"
21 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
22 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterIndirectScribbleDelegate.h"
23 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h"
24 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h"
25 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterRestorationPlugin.h"
26 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h"
27 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h"
28 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h"
29
30 NS_ASSUME_NONNULL_BEGIN
31
32 @interface FlutterEngine () <FlutterViewEngineDelegate>
33
34 - (void)updateViewportMetrics:(flutter::ViewportMetrics)viewportMetrics;
35 - (void)dispatchPointerDataPacket:(std::unique_ptr<flutter::PointerDataPacket>)packet;
36
37 - (fml::RefPtr<fml::TaskRunner>)platformTaskRunner;
38 - (fml::RefPtr<fml::TaskRunner>)uiTaskRunner;
39 - (fml::RefPtr<fml::TaskRunner>)rasterTaskRunner;
40
41 - (void)installFirstFrameCallback:(void (^)(void))block;
42 - (void)enableSemantics:(BOOL)enabled withFlags:(int64_t)flags;
43 - (void)notifyViewCreated;
44 - (void)notifyViewDestroyed;
45
46 - (flutter::Rasterizer::Screenshot)screenshot:(flutter::Rasterizer::ScreenshotType)type
47 base64Encode:(bool)base64Encode;
48
49 - (FlutterPlatformPlugin*)platformPlugin;
50 - (FlutterTextInputPlugin*)textInputPlugin;
51 - (FlutterRestorationPlugin*)restorationPlugin;
52 - (void)launchEngine:(nullable NSString*)entrypoint
53 libraryURI:(nullable NSString*)libraryOrNil
54 entrypointArgs:(nullable NSArray<NSString*>*)entrypointArgs;
55 - (BOOL)createShell:(nullable NSString*)entrypoint
56 libraryURI:(nullable NSString*)libraryOrNil
57 initialRoute:(nullable NSString*)initialRoute;
58 - (void)attachView;
59 - (void)notifyLowMemory;
60
61 /// Blocks until the first frame is presented or the timeout is exceeded, then invokes callback.
62 - (void)waitForFirstFrameSync:(NSTimeInterval)timeout
63 callback:(NS_NOESCAPE void (^)(BOOL didTimeout))callback;
64
65 /// Asynchronously waits until the first frame is presented or the timeout is exceeded, then invokes
66 /// callback.
67 - (void)waitForFirstFrame:(NSTimeInterval)timeout callback:(void (^)(BOOL didTimeout))callback;
68
69 /**
70 * Creates one running FlutterEngine from another, sharing components between them.
71 *
72 * This results in a faster creation time and a smaller memory footprint engine.
73 * This should only be called on a FlutterEngine that is running.
74 */
75 - (FlutterEngine*)spawnWithEntrypoint:(nullable NSString*)entrypoint
76 libraryURI:(nullable NSString*)libraryURI
77 initialRoute:(nullable NSString*)initialRoute
78 entrypointArgs:(nullable NSArray<NSString*>*)entrypointArgs;
79
80 /**
81 * Dispatches the given key event data to the framework through the engine.
82 * The callback is called once the response from the framework is received.
83 */
84 - (void)sendKeyEvent:(const FlutterKeyEvent&)event
85 callback:(nullable FlutterKeyEventCallback)callback
86 userData:(nullable void*)userData;
87
88 @property(nonatomic, readonly) FlutterDartProject* project;
89
90 /**
91 * Returns the engine handle. Used in FlutterEngineTest.
92 */
93 - (int64_t)engineIdentifier;
94
95 /**
96 * Returns engine for the identifier. The identifier must be valid for an engine
97 * that is currently running, otherwise the behavior is undefined.
98 *
99 * The identifier can be obtained in Dart code through
100 * `PlatformDispatcher.instance.engineId`.
101 *
102 * This function must be called on the main thread.
103 */
104 + (nullable FlutterEngine*)engineForIdentifier:(int64_t)identifier;
105
106 @end
107
108 NS_ASSUME_NONNULL_END
109
110 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERENGINE_INTERNAL_H_
FlutterDartProject_Internal.h
FlutterEngine.h
FlutterIndirectScribbleDelegate.h
NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_BEGIN
Definition: FlutterMacros.h:19
NS_ASSUME_NONNULL_END
#define NS_ASSUME_NONNULL_END
Definition: FlutterMacros.h:20
FlutterPlatformPlugin.h
FlutterPlatformViews_Internal.h
FlutterRestorationPlugin.h
FlutterTextInputDelegate.h
FlutterTextInputPlugin.h
textInputPlugin
FlutterTextInputPlugin * textInputPlugin
Definition: FlutterTextInputPluginTest.mm:93
FlutterView.h
FlutterDartProject
Definition: FlutterDartProject.mm:255
FlutterEngine
Definition: FlutterEngine.h:61
FlutterPlatformPlugin
Definition: FlutterPlatformPlugin.h:12
FlutterRestorationPlugin
Definition: FlutterRestorationPlugin.h:13
FlutterTextInputPlugin
Definition: FlutterTextInputPlugin.h:34
flutter
Definition: accessibility_bridge.h:26
fml
Definition: profiler_metrics_ios.mm:41
FlutterViewEngineDelegate-p
Definition: FlutterView.h:14