Flutter Engine
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_FLUTTERHEADLESSDARTRUNNER_H_
6 #define FLUTTER_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  * Most callers should prefer using `FlutterEngine` directly; this interface exists
30  * for legacy support.
31  */
33 FLUTTER_DEPRECATED("FlutterEngine should be used rather than FlutterHeadlessDartRunner")
35 
36 /**
37  * Iniitalize 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  * Iniitalize 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 NS_DESIGNATED_INITIALIZER;
68 
69 /**
70  * Not recommended for use - will initialize with a default label ("io.flutter.headless")
71  * and the default FlutterDartProject.
72  */
73 - (instancetype)init;
74 
75 @end
76 
77 #endif // FLUTTER_FLUTTERHEADLESSDARTRUNNER_H_
void(^ FlutterHeadlessDartRunnerCallback)(BOOL success)
#define FLUTTER_DEPRECATED(msg)
Definition: FlutterMacros.h:30
#define FLUTTER_EXPORT