Flutter iOS Embedder
FlutterHeadlessDartRunner.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_HEADERS_FLUTTERHEADLESSDARTRUNNER_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_HEADERS_FLUTTERHEADLESSDARTRUNNER_H_
7 
8 #import <Foundation/Foundation.h>
9 
11 #import "FlutterDartProject.h"
12 #import "FlutterEngine.h"
13 #import "FlutterMacros.h"
14 
15 /**
16  * A callback for when FlutterHeadlessDartRunner has attempted to start a Dart
17  * Isolate in the background.
18  *
19  * @param success YES if the Isolate was started and run successfully, NO
20  * otherwise.
21  */
22 typedef void (^FlutterHeadlessDartRunnerCallback)(BOOL success);
23 
24 /**
25  * The deprecated FlutterHeadlessDartRunner runs Flutter Dart code with a null rasterizer,
26  * and no native drawing surface. It is appropriate for use in running Dart
27  * code e.g. in the background from a plugin.
28  *
29  * Like any `FlutterEngine`, this class must be created and run on the main thread.
30  * See `FlutterEngine` class documentation.
31  *
32  * Most callers should prefer using `FlutterEngine` directly; this interface exists
33  * for legacy support.
34  */
36 FLUTTER_DEPRECATED("FlutterEngine should be used rather than FlutterHeadlessDartRunner")
38 
39 /**
40  * Initialize this FlutterHeadlessDartRunner with a `FlutterDartProject`.
41  *
42  * If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate
43  * the project in a default location.
44  *
45  * A newly initialized engine will not run the `FlutterDartProject` until either
46  * `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called.
47  *
48  * @param labelPrefix The label prefix used to identify threads for this instance. Should
49  * be unique across FlutterEngine instances
50  * @param projectOrNil The `FlutterDartProject` to run.
51  */
52 - (instancetype)initWithName:(NSString*)labelPrefix
53  project:(FlutterDartProject*)projectOrNil NS_SWIFT_UI_ACTOR;
54 
55 /**
56  * Initialize this FlutterHeadlessDartRunner with a `FlutterDartProject`.
57  *
58  * If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate
59  * the project in a default location.
60  *
61  * A newly initialized engine will not run the `FlutterDartProject` until either
62  * `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called.
63  *
64  * @param labelPrefix The label prefix used to identify threads for this instance. Should
65  * be unique across FlutterEngine instances
66  * @param projectOrNil The `FlutterDartProject` to run.
67  * @param allowHeadlessExecution Must be set to `YES`.
68  */
69 - (instancetype)initWithName:(NSString*)labelPrefix
70  project:(FlutterDartProject*)projectOrNil
71  allowHeadlessExecution:(BOOL)allowHeadlessExecution NS_SWIFT_UI_ACTOR;
72 
73 /**
74  * Initialize this FlutterHeadlessDartRunner with a `FlutterDartProject`.
75  *
76  * If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate
77  * the project in a default location.
78  *
79  * A newly initialized engine will not run the `FlutterDartProject` until either
80  * `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called.
81  *
82  * @param labelPrefix The label prefix used to identify threads for this instance. Should
83  * be unique across FlutterEngine instances
84  * @param projectOrNil The `FlutterDartProject` to run.
85  * @param allowHeadlessExecution Must be set to `YES`.
86  * @param restorationEnabled Must be set to `NO`.
87  */
88 - (instancetype)initWithName:(NSString*)labelPrefix
89  project:(FlutterDartProject*)projectOrNil
90  allowHeadlessExecution:(BOOL)allowHeadlessExecution
91  restorationEnabled:(BOOL)restorationEnabled NS_DESIGNATED_INITIALIZER NS_SWIFT_UI_ACTOR;
92 
93 /**
94  * Not recommended for use - will initialize with a default label ("io.flutter.headless")
95  * and the default FlutterDartProject.
96  */
97 - (instancetype)init NS_SWIFT_UI_ACTOR;
98 
99 @end
100 
101 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_HEADERS_FLUTTERHEADLESSDARTRUNNER_H_
void(^ FlutterHeadlessDartRunnerCallback)(BOOL success)
#define FLUTTER_DEPRECATED(msg)
Definition: FlutterMacros.h:30
#define FLUTTER_DARWIN_EXPORT
Definition: FlutterMacros.h:14
instancetype NS_SWIFT_UI_ACTOR()