Flutter Engine
 
Loading...
Searching...
No Matches
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
9
17
19
30
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;
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@end
128
130
131@end
132
134
135#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERENGINE_INTERNAL_H_
#define NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_END
void(* FlutterKeyEventCallback)(bool, void *)
Definition embedder.h:1427
FlutterTextInputPlugin * textInputPlugin
Definition ref_ptr.h:261
int BOOL