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