| 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/FlutterSceneLifeCycle_Internal.h"
27 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h"
28 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h"
29 #import "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h"
30
31 NS_ASSUME_NONNULL_BEGIN
32
33 @interface FlutterEngine () <FlutterViewEngineDelegate>
34
35 // Indicates whether this engine has **ever** been manually registered to a scene.
36 @property(nonatomic, assign) BOOL manuallyRegisteredToScene;
37
38 - (void)updateViewportMetrics:(flutter::ViewportMetrics)viewportMetrics;
39 - (void)dispatchPointerDataPacket:(std::unique_ptr<flutter::PointerDataPacket>)packet;
40
41 - (fml::RefPtr<fml::TaskRunner>)platformTaskRunner;
42 - (fml::RefPtr<fml::TaskRunner>)uiTaskRunner;
43 - (fml::RefPtr<fml::TaskRunner>)rasterTaskRunner;
44
45 - (void)installFirstFrameCallback:(void (^)(void))block;
46 - (void)enableSemantics:(BOOL)enabled withFlags:(int64_t)flags;
47 - (void)notifyViewCreated;
48 - (void)notifyViewDestroyed;
49
50 - (flutter::Rasterizer::Screenshot)screenshot:(flutter::Rasterizer::ScreenshotType)type
51 base64Encode:(bool)base64Encode;
52
53 - (FlutterPlatformPlugin*)platformPlugin;
54 - (FlutterTextInputPlugin*)textInputPlugin;
55 - (FlutterRestorationPlugin*)restorationPlugin;
56 - (FlutterEnginePluginSceneLifeCycleDelegate*)sceneLifeCycleDelegate;
57 - (void)launchEngine:(nullable NSString*)entrypoint
58 libraryURI:(nullable NSString*)libraryOrNil
59 entrypointArgs:(nullable NSArray<NSString*>*)entrypointArgs;
60 - (BOOL)createShell:(nullable NSString*)entrypoint
61 libraryURI:(nullable NSString*)libraryOrNil
62 initialRoute:(nullable NSString*)initialRoute;
63 - (void)attachView;
64 - (void)notifyLowMemory;
65
66 /// Blocks until the first frame is presented or the timeout is exceeded, then invokes callback.
67 - (void)waitForFirstFrameSync:(NSTimeInterval)timeout
68 callback:(NS_NOESCAPE void (^)(BOOL didTimeout))callback;
69
70 /// Asynchronously waits until the first frame is presented or the timeout is exceeded, then invokes
71 /// callback.
72 - (void)waitForFirstFrame:(NSTimeInterval)timeout callback:(void (^)(BOOL didTimeout))callback;
73
74 /**
75 * Creates one running FlutterEngine from another, sharing components between them.
76 *
77 * This results in a faster creation time and a smaller memory footprint engine.
78 * This should only be called on a FlutterEngine that is running.
79 */
80 - (FlutterEngine*)spawnWithEntrypoint:(nullable NSString*)entrypoint
81 libraryURI:(nullable NSString*)libraryURI
82 initialRoute:(nullable NSString*)initialRoute
83 entrypointArgs:(nullable NSArray<NSString*>*)entrypointArgs;
84
85 /**
86 * Dispatches the given key event data to the framework through the engine.
87 * The callback is called once the response from the framework is received.
88 */
89 - (void)sendKeyEvent:(const FlutterKeyEvent&)event
90 callback:(nullable FlutterKeyEventCallback)callback
91 userData:(nullable void*)userData;
92
93 @property(nonatomic, readonly) FlutterDartProject* project;
94
95 /**
96 * Returns the engine handle. Used in FlutterEngineTest.
97 */
98 - (int64_t)engineIdentifier;
99
100 /**
101 * Returns engine for the identifier. The identifier must be valid for an engine
102 * that is currently running, otherwise the behavior is undefined.
103 *
104 * The identifier can be obtained in Dart code through
105 * `PlatformDispatcher.instance.engineId`.
106 *
107 * This function must be called on the main thread.
108 */
109 + (nullable FlutterEngine*)engineForIdentifier:(int64_t)identifier;
110
111 - (void)addSceneLifeCycleDelegate:(NSObject<FlutterSceneLifeCycleDelegate>*)delegate;
112
113 /*
114 * Performs AppDelegate callback provided through the `FlutterImplicitEngineDelegate` protocol to
115 * inform apps that the implicit `FlutterEngine` has initialized.
116 */
117 - (BOOL)performImplicitEngineCallback;
118
119 /*
120 * Creates a `FlutterEngineApplicationRegistrar` that can be used to access application-level
121 * services, such as the engine's `FlutterBinaryMessenger` or `FlutterTextureRegistry`.
122 */
123 - (NSObject<FlutterApplicationRegistrar>*)registrarForApplication:(NSString*)key;
124
125 - (void)sendDeepLinkToFramework:(NSURL*)url completionHandler:(void (^)(BOOL success))completion;
126
127 - (void)onStatusBarTap;
128 @end
129
130 @interface FlutterImplicitEngineBridgeImpl : NSObject <FlutterImplicitEngineBridge>
131
132 @end
133
134 NS_ASSUME_NONNULL_END
135
136 #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
FlutterSceneLifeCycle_Internal.h
FlutterTextInputDelegate.h
FlutterTextInputPlugin.h
textInputPlugin
FlutterTextInputPlugin * textInputPlugin
Definition: FlutterTextInputPluginTest.mm:138
FlutterView.h
FlutterEngine(Test)::restorationPlugin
FlutterRestorationPlugin * restorationPlugin
Definition: FlutterEngine_Test.h:27
FlutterDartProject
Definition: FlutterDartProject.mm:268
FlutterEnginePluginSceneLifeCycleDelegate
Definition: FlutterSceneLifeCycle.mm:511
FlutterImplicitEngineBridgeImpl
Definition: FlutterEngine.mm:172
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
FlutterApplicationRegistrar-p
Definition: FlutterPlugin.h:337
FlutterImplicitEngineBridge-p
Definition: FlutterEngine.h:456
FlutterSceneLifeCycleDelegate-p
Definition: FlutterSceneLifeCycle.h:31
FlutterViewEngineDelegate-p
Definition: FlutterView.h:14