| Flutter iOS Embedder |

FlutterEngineGroup.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 #import <Foundation/Foundation.h>
6
7 #import "FlutterEngine.h"
8
9 NS_ASSUME_NONNULL_BEGIN
10
11 /** Options that control how a FlutterEngine should be created. */
12 FLUTTER_DARWIN_EXPORT
13 @interface FlutterEngineGroupOptions : NSObject
14
15 /**
16 * The name of a top-level function from a Dart library. If this is FlutterDefaultDartEntrypoint
17 * (or nil); this will default to `main()`. If it is not the app's main() function, that function
18 * must be decorated with `@pragma(vm:entry-point)` to ensure themethod is not tree-shaken by the
19 * Dart compiler.
20 */
21 @property(nonatomic, copy, nullable) NSString* entrypoint;
22
23 /**
24 * The URI of the Dart library which contains the entrypoint method. If nil, this will default to
25 * the same library as the `main()` function in the Dart program.
26 */
27 @property(nonatomic, copy, nullable) NSString* libraryURI;
28
29 /**
30 * The name of the initial Flutter `Navigator` `Route` to load. If this is
31 * FlutterDefaultInitialRoute (or nil), it will default to the "/" route.
32 */
33 @property(nonatomic, copy, nullable) NSString* initialRoute;
34
35 /**
36 * Arguments passed as a list of string to Dart's entrypoint function.
37 */
38 @property(nonatomic, retain, nullable) NSArray<NSString*>* entrypointArgs;
39 @end
40
41 /**
42 * Represents a collection of FlutterEngines who share resources which allows
43 * them to be created with less time const and occupy less memory than just
44 * creating multiple FlutterEngines.
45 *
46 * Deleting a FlutterEngineGroup doesn't invalidate existing FlutterEngines, but
47 * it eliminates the possibility to create more FlutterEngines in that group.
48 *
49 * @warning This class is a work-in-progress and may change.
50 * @see https://github.com/flutter/flutter/issues/72009
51 */
52 FLUTTER_DARWIN_EXPORT
53 @interface FlutterEngineGroup : NSObject
54 - (instancetype)init NS_UNAVAILABLE;
55
56 /**
57 * Initialize a new FlutterEngineGroup.
58 *
59 * @param name The name that will present in the threads shared across the
60 * engines in this group.
61 * @param project The `FlutterDartProject` that all FlutterEngines in this group
62 * will be executing.
63 */
64 - (instancetype)initWithName:(NSString*)name
65 project:(nullable FlutterDartProject*)project NS_DESIGNATED_INITIALIZER;
66
67 /**
68 * Creates a running `FlutterEngine` that shares components with this group.
69 *
70 * @param entrypoint The name of a top-level function from a Dart library. If this is
71 * FlutterDefaultDartEntrypoint (or nil); this will default to `main()`. If it is not the app's
72 * main() function, that function must be decorated with `@pragma(vm:entry-point)` to ensure the
73 * method is not tree-shaken by the Dart compiler.
74 * @param libraryURI The URI of the Dart library which contains the entrypoint method. IF nil,
75 * this will default to the same library as the `main()` function in the Dart program.
76 *
77 * @see FlutterEngineGroup
78 */
79 - (FlutterEngine*)makeEngineWithEntrypoint:(nullable NSString*)entrypoint
80 libraryURI:(nullable NSString*)libraryURI;
81
82 /**
83 * Creates a running `FlutterEngine` that shares components with this group.
84 *
85 * @param entrypoint The name of a top-level function from a Dart library. If this is
86 * FlutterDefaultDartEntrypoint (or nil); this will default to `main()`. If it is not the app's
87 * main() function, that function must be decorated with `@pragma(vm:entry-point)` to ensure the
88 * method is not tree-shaken by the Dart compiler.
89 * @param libraryURI The URI of the Dart library which contains the entrypoint method. IF nil,
90 * this will default to the same library as the `main()` function in the Dart program.
91 * @param initialRoute The name of the initial Flutter `Navigator` `Route` to load. If this is
92 * FlutterDefaultInitialRoute (or nil), it will default to the "/" route.
93 *
94 * @see FlutterEngineGroup
95 */
96 - (FlutterEngine*)makeEngineWithEntrypoint:(nullable NSString*)entrypoint
97 libraryURI:(nullable NSString*)libraryURI
98 initialRoute:(nullable NSString*)initialRoute;
99
100 /**
101 * Creates a running `FlutterEngine` that shares components with this group.
102 *
103 * @param options Options that control how a FlutterEngine should be created.
104 *
105 * @see FlutterEngineGroupOptions
106 */
107 - (FlutterEngine*)makeEngineWithOptions:(nullable FlutterEngineGroupOptions*)options;
108 @end
109
110 NS_ASSUME_NONNULL_END
FlutterEngine
Definition: FlutterEngine.h:61
FlutterEngine.h
FlutterEngineGroupOptions::libraryURI
NSString * libraryURI
Definition: FlutterEngineGroup.h:27
NS_ASSUME_NONNULL_END
#define NS_ASSUME_NONNULL_END
Definition: FlutterMacros.h:20
NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_BEGIN
Definition: FlutterMacros.h:19
FlutterEngineGroupOptions::entrypoint
NSString * entrypoint
Definition: FlutterEngineGroup.h:21
FlutterEngineGroupOptions::initialRoute
NSString * initialRoute
Definition: FlutterEngineGroup.h:33
FlutterEngineGroupOptions
Definition: FlutterEngineGroup.h:13
NS_UNAVAILABLE
instancetype init NS_UNAVAILABLE
Definition: FlutterTextInputPlugin.h:164
FLUTTER_DARWIN_EXPORT
#define FLUTTER_DARWIN_EXPORT
Definition: FlutterMacros.h:14
FlutterEngineGroupOptions::entrypointArgs
NSArray< NSString * > * entrypointArgs
Definition: FlutterEngineGroup.h:38
FlutterDartProject
Definition: FlutterDartProject.mm:262
FlutterEngineGroup
Definition: FlutterEngineGroup.h:53