| 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
10 #import "FlutterBinaryMessenger.h"
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 * Most callers should prefer using `FlutterEngine` directly; this interface exists
30 * for legacy support.
31 */
32 FLUTTER_DARWIN_EXPORT
33 FLUTTER_DEPRECATED("FlutterEngine should be used rather than FlutterHeadlessDartRunner")
34 @interface FlutterHeadlessDartRunner : FlutterEngine
35
36 /**
37 * Initialize this FlutterHeadlessDartRunner with a `FlutterDartProject`.
38 *
39 * If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate
40 * the project in a default location.
41 *
42 * A newly initialized engine will not run the `FlutterDartProject` until either
43 * `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called.
44 *
45 * @param labelPrefix The label prefix used to identify threads for this instance. Should
46 * be unique across FlutterEngine instances
47 * @param projectOrNil The `FlutterDartProject` to run.
48 */
49 - (instancetype)initWithName:(NSString*)labelPrefix project:(FlutterDartProject*)projectOrNil;
50
51 /**
52 * Initialize this FlutterHeadlessDartRunner with a `FlutterDartProject`.
53 *
54 * If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate
55 * the project in a default location.
56 *
57 * A newly initialized engine will not run the `FlutterDartProject` until either
58 * `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called.
59 *
60 * @param labelPrefix The label prefix used to identify threads for this instance. Should
61 * be unique across FlutterEngine instances
62 * @param projectOrNil The `FlutterDartProject` to run.
63 * @param allowHeadlessExecution Must be set to `YES`.
64 */
65 - (instancetype)initWithName:(NSString*)labelPrefix
66 project:(FlutterDartProject*)projectOrNil
67 allowHeadlessExecution:(BOOL)allowHeadlessExecution;
68
69 /**
70 * Initialize this FlutterHeadlessDartRunner with a `FlutterDartProject`.
71 *
72 * If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate
73 * the project in a default location.
74 *
75 * A newly initialized engine will not run the `FlutterDartProject` until either
76 * `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called.
77 *
78 * @param labelPrefix The label prefix used to identify threads for this instance. Should
79 * be unique across FlutterEngine instances
80 * @param projectOrNil The `FlutterDartProject` to run.
81 * @param allowHeadlessExecution Must be set to `YES`.
82 * @param restorationEnabled Must be set to `NO`.
83 */
84 - (instancetype)initWithName:(NSString*)labelPrefix
85 project:(FlutterDartProject*)projectOrNil
86 allowHeadlessExecution:(BOOL)allowHeadlessExecution
87 restorationEnabled:(BOOL)restorationEnabled NS_DESIGNATED_INITIALIZER;
88
89 /**
90 * Not recommended for use - will initialize with a default label ("io.flutter.headless")
91 * and the default FlutterDartProject.
92 */
93 - (instancetype)init;
94
95 @end
96
97 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_HEADERS_FLUTTERHEADLESSDARTRUNNER_H_
FlutterBinaryMessenger.h
FlutterDartProject.h
FlutterEngine.h
FlutterHeadlessDartRunnerCallback
void(^ FlutterHeadlessDartRunnerCallback)(BOOL success)
Definition: FlutterHeadlessDartRunner.h:22
FlutterMacros.h
FLUTTER_DEPRECATED
#define FLUTTER_DEPRECATED(msg)
Definition: FlutterMacros.h:30
FLUTTER_DARWIN_EXPORT
#define FLUTTER_DARWIN_EXPORT
Definition: FlutterMacros.h:14
FlutterDartProject
Definition: FlutterDartProject.mm:255
FlutterEngine
Definition: FlutterEngine.h:61
FlutterHeadlessDartRunner
Definition: FlutterHeadlessDartRunner.h:35
-[FlutterHeadlessDartRunner init]
instancetype init()
Definition: FlutterHeadlessDartRunner.mm:57