| 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/platform_view_ios.h"
29
30 NS_ASSUME_NONNULL_BEGIN
31
32 extern NSString* const kFlutterEngineWillDealloc;
33
34 @interface FlutterEngine () <FlutterViewEngineDelegate>
35
36 - (flutter::Shell&)shell;
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 - (fml::WeakPtr<flutter::PlatformView>)platformView;
46
47 - (flutter::Rasterizer::Screenshot)screenshot:(flutter::Rasterizer::ScreenshotType)type
48 base64Encode:(bool)base64Encode;
49
50 - (FlutterPlatformPlugin*)platformPlugin;
51 - (std::shared_ptr<flutter::FlutterPlatformViewsController>&)platformViewsController;
52 - (FlutterTextInputPlugin*)textInputPlugin;
53 - (FlutterRestorationPlugin*)restorationPlugin;
54 - (void)launchEngine:(nullable NSString*)entrypoint
55 libraryURI:(nullable NSString*)libraryOrNil
56 entrypointArgs:(nullable NSArray<NSString*>*)entrypointArgs;
57 - (BOOL)createShell:(nullable NSString*)entrypoint
58 libraryURI:(nullable NSString*)libraryOrNil
59 initialRoute:(nullable NSString*)initialRoute;
60 - (void)attachView;
61 - (void)notifyLowMemory;
62 - (flutter::PlatformViewIOS*)iosPlatformView;
63
64 - (void)waitForFirstFrame:(NSTimeInterval)timeout callback:(void (^)(BOOL didTimeout))callback;
65
66 /**
67 * Creates one running FlutterEngine from another, sharing components between them.
68 *
69 * This results in a faster creation time and a smaller memory footprint engine.
70 * This should only be called on a FlutterEngine that is running.
71 */
72 - (FlutterEngine*)spawnWithEntrypoint:(nullable NSString*)entrypoint
73 libraryURI:(nullable NSString*)libraryURI
74 initialRoute:(nullable NSString*)initialRoute
75 entrypointArgs:(nullable NSArray<NSString*>*)entrypointArgs;
76
77 /**
78 * Dispatches the given key event data to the framework through the engine.
79 * The callback is called once the response from the framework is received.
80 */
81 - (void)sendKeyEvent:(const FlutterKeyEvent&)event
82 callback:(nullable FlutterKeyEventCallback)callback
83 userData:(nullable void*)userData;
84
85 @property(nonatomic, readonly) FlutterDartProject* project;
86 @end
87
88 NS_ASSUME_NONNULL_END
89
90 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERENGINE_INTERNAL_H_
FlutterEngine
Definition: FlutterEngine.h:61
FlutterEngine.h
FlutterRestorationPlugin.h
NS_ASSUME_NONNULL_END
#define NS_ASSUME_NONNULL_END
Definition: FlutterMacros.h:20
FlutterTextInputDelegate.h
FlutterRestorationPlugin
Definition: FlutterRestorationPlugin.h:12
FlutterTextInputPlugin.h
FlutterViewEngineDelegate-p
Definition: FlutterView.h:19
NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_BEGIN
Definition: FlutterMacros.h:19
kFlutterEngineWillDealloc
NS_ASSUME_NONNULL_BEGIN NSString *const kFlutterEngineWillDealloc
Definition: FlutterEngine.mm:85
flutter
Definition: accessibility_bridge.h:28
FlutterTextInputPlugin
Definition: FlutterTextInputPlugin.h:33
FlutterPlatformViews_Internal.h
FlutterIndirectScribbleDelegate.h
FlutterPlatformPlugin.h
FlutterDartProject_Internal.h
textInputPlugin
FlutterTextInputPlugin * textInputPlugin
Definition: FlutterTextInputPluginTest.mm:90
FlutterPlatformPlugin
Definition: FlutterPlatformPlugin.h:12
platform_view_ios.h
FlutterDartProject
Definition: FlutterDartProject.mm:264