# FlutterHeadlessDartRunner

Deprecated

FlutterEngine should be used rather than FlutterHeadlessDartRunner

Objective-C

    @interface FlutterHeadlessDartRunner : FlutterEngine

Swift

    class FlutterHeadlessDartRunner : FlutterEngine

The deprecated FlutterHeadlessDartRunner runs Flutter Dart code with a null rasterizer, and no native drawing surface. It is appropriate for use in running Dart code e.g. in the background from a plugin.

Most callers should prefer using `FlutterEngine` directly; this interface exists for legacy support.

- `-initWithName:project:`

  Initialize this FlutterHeadlessDartRunner with a `FlutterDartProject`.

  If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate the project in a default location.

  A newly initialized engine will not run the `FlutterDartProject` until either `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called.

  #### Declaration

  Objective-C

      - (instancetype)initWithName:(NSString *)labelPrefix
                           project:(FlutterDartProject *)projectOrNil;

  Swift

      convenience init!(name labelPrefix: String!, project projectOrNil: FlutterDartProject!)

  #### Parameters

  `labelPrefix` | The label prefix used to identify threads for this instance. Should be unique across FlutterEngine instances
  `projectOrNil` | The `FlutterDartProject` to run.

- `-initWithName:project:allowHeadlessExecution:`

  Initialize this FlutterHeadlessDartRunner with a `FlutterDartProject`.

  If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate the project in a default location.

  A newly initialized engine will not run the `FlutterDartProject` until either `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called.

  #### Declaration

  Objective-C

      - (instancetype)initWithName:(NSString *)labelPrefix
                           project:(FlutterDartProject *)projectOrNil
            allowHeadlessExecution:(BOOL)allowHeadlessExecution;

  Swift

      convenience init!(name labelPrefix: String!, project projectOrNil: FlutterDartProject!, allowHeadlessExecution: Bool)

  #### Parameters

  `labelPrefix` | The label prefix used to identify threads for this instance. Should be unique across FlutterEngine instances
  `projectOrNil` | The `FlutterDartProject` to run.
  `allowHeadlessExecution` | Must be set to `YES`.

- `-initWithName:project:allowHeadlessExecution:restorationEnabled:`

  Initialize this FlutterHeadlessDartRunner with a `FlutterDartProject`.

  If the FlutterDartProject is not specified, the FlutterHeadlessDartRunner will attempt to locate the project in a default location.

  A newly initialized engine will not run the `FlutterDartProject` until either `-runWithEntrypoint:` or `-runWithEntrypoint:libraryURI` is called.

  #### Declaration

  Objective-C

      - (instancetype)initWithName:(NSString *)labelPrefix
                           project:(FlutterDartProject *)projectOrNil
            allowHeadlessExecution:(BOOL)allowHeadlessExecution
                restorationEnabled:(BOOL)restorationEnabled;

  Swift

      init!(name labelPrefix: String!, project projectOrNil: FlutterDartProject!, allowHeadlessExecution: Bool, restorationEnabled: Bool)

  #### Parameters

  `labelPrefix` | The label prefix used to identify threads for this instance. Should be unique across FlutterEngine instances
  `projectOrNil` | The `FlutterDartProject` to run.
  `allowHeadlessExecution` | Must be set to `YES`.
  `restorationEnabled` | Must be set to `NO`.

- `-init`

  Not recommended for use - will initialize with a default label (“io.flutter.headless”) and the default FlutterDartProject.

  #### Declaration

  Objective-C

      - (instancetype)init;

  Swift

      convenience init!()

© 2023 Flutter. All rights reserved. (Last updated: 2023-06-13)

Generated by jazzy ♪♫ v0.14.3, a Realm project.