Flutter Engine
FlutterDartProject Class Reference

#import <FlutterDartProject.h>

Inheritance diagram for FlutterDartProject:

Instance Methods

(instancetype) - initWithPrecompiledDartBundle:
 
("Use -init instead.") - FLUTTER_UNAVAILABLE
 
(nonnull instancetype) - initWithPrecompiledDartBundle:
 
(const flutter::Settings &) - settings [implementation]
 
(const flutter::PlatformData- defaultPlatformData [implementation]
 
(flutter::RunConfiguration- runConfiguration [implementation]
 
(flutter::RunConfiguration- runConfigurationForEntrypoint: [implementation]
 
(flutter::RunConfiguration- runConfigurationForEntrypoint:libraryOrNil: [implementation]
 
(void) - setPersistentIsolateData: [implementation]
 
(nonnull instancetype) - initWithAssetsPath:ICUDataPath: [implementation]
 

Class Methods

(NSString *) + lookupKeyForAsset:
 
(NSString *) + lookupKeyForAsset:fromBundle:
 
(NSString *) + lookupKeyForAsset:fromPackage:
 
(NSString *) + lookupKeyForAsset:fromPackage:fromBundle:
 
(NSString *) + defaultBundleIdentifier
 
(NSString *) + flutterAssetsName: [implementation]
 
(NSString *) + domainNetworkPolicy: [implementation]
 
(bool) + allowsArbitraryLoads: [implementation]
 

Properties

bool enableMirrors
 
NSArray< NSString * > * dartEntrypointArguments
 
NSString * assetsPath [implementation]
 
NSString * ICUDataPath [implementation]
 
std::vector< std::string > switches [implementation]
 

Detailed Description

A set of Flutter and Dart assets used by a FlutterEngine to initialize execution.

A set of Flutter and Dart assets used by a FlutterEngine to initialize execution.

TODO(stuartmorgan): Align API with FlutterDartProject, and combine.

Definition at line 18 of file FlutterDartProject.h.

Method Documentation

◆ allowsArbitraryLoads:()

+ (bool) allowsArbitraryLoads: (NSDictionary *)  appTransportSecurity
implementation

◆ defaultBundleIdentifier()

+ (NSString *) defaultBundleIdentifier

Returns the default identifier for the bundle where we expect to find the Flutter Dart application.

Definition at line 289 of file FlutterDartProject.mm.

Referenced by initWithPrecompiledDartBundle:.

289  {
290  return @"io.flutter.flutter.app";
291 }

◆ defaultPlatformData()

- (const PlatformData FlutterDartProject()):
implementation

◆ domainNetworkPolicy:()

+ (NSString*) domainNetworkPolicy: (NSDictionary *)  appTransportSecurity
implementation

◆ FLUTTER_UNAVAILABLE()

- ("Use -init instead.") FLUTTER_UNAVAILABLE

Unavailable - use init instead.

◆ flutterAssetsName:()

+ (NSString*) flutterAssetsName: (NSBundle *)  bundle
implementation

◆ initWithAssetsPath:ICUDataPath:()

- (nonnull instancetype) initWithAssetsPath: (nonnull NSString *)  assets
ICUDataPath: (nonnull NSString *)  NS_DESIGNATED_INITIALIZER 
implementation

Instead of looking up the assets and ICU data path in the application bundle, this initializer allows callers to create a Dart project with custom locations specified for the both.

◆ initWithPrecompiledDartBundle:() [1/2]

- (nonnull instancetype) initWithPrecompiledDartBundle: (nullable NSBundle *)  NS_DESIGNATED_INITIALIZER

Initializes a Flutter Dart project from a bundle.

The bundle must either contain a flutter_assets resource directory, or set the Info.plist key FLTAssetsPath to override that name (if you are doing a custom build using a different name).

Parameters
bundleThe bundle containing the Flutter assets directory. If nil, the App framework created by Flutter will be used.

◆ initWithPrecompiledDartBundle:() [2/2]

- (instancetype) initWithPrecompiledDartBundle: (nullable NSBundle*)  NS_DESIGNATED_INITIALIZER

Initializes a Flutter Dart project from a bundle.

Definition at line 180 of file FlutterDartProject.mm.

References defaultBundleIdentifier, defaultPlatformData, DefaultSettingsForProcess(), flutter::RunConfiguration::InferFromSettings(), flutter::PlatformData::lifecycle_state, runConfiguration, runConfigurationForEntrypoint:, runConfigurationForEntrypoint:libraryOrNil:, and settings.

180  :(nullable NSBundle*)bundle {
181  self = [super init];
182 
183  if (self) {
184  _settings = DefaultSettingsForProcess(bundle);
185  }
186 
187  return self;
188 }
static flutter::Settings DefaultSettingsForProcess(NSBundle *bundle=nil)

◆ lookupKeyForAsset:()

+ (NSString *) lookupKeyForAsset: (NSString*)  asset

Returns the file name for the given asset. If the bundle with the identifier "io.flutter.flutter.app" exists, it will try use that bundle; otherwise, it will use the main bundle. To specify a different bundle, use -lookupKeyForAsset:asset:fromBundle.

Parameters
assetThe name of the asset. The name can be hierarchical.
Returns
the file name to be used for lookup in the main bundle.

Definition at line 269 of file FlutterDartProject.mm.

References lookupKeyForAsset:fromBundle:.

Referenced by FlutterViewController::lookupKeyForAsset:, and FlutterEngine::run.

269  :(NSString*)asset {
270  return [self lookupKeyForAsset:asset fromBundle:nil];
271 }

◆ lookupKeyForAsset:fromBundle:()

+ (NSString *) lookupKeyForAsset: (NSString*)  asset
fromBundle: (nullable NSBundle*)  bundle 

Returns the file name for the given asset. The returned file name can be used to access the asset in the supplied bundle.

Parameters
assetThe name of the asset. The name can be hierarchical.
bundleThe NSBundle to use for looking up the asset.
Returns
the file name to be used for lookup in the main bundle.

Definition at line 273 of file FlutterDartProject.mm.

References flutterAssetsName:.

Referenced by lookupKeyForAsset:, and lookupKeyForAsset:fromPackage:fromBundle:.

273  :(NSString*)asset fromBundle:(nullable NSBundle*)bundle {
274  NSString* flutterAssetsName = [FlutterDartProject flutterAssetsName:bundle];
275  return [NSString stringWithFormat:@"%@/%@", flutterAssetsName, asset];
276 }
NSString * flutterAssetsName:(NSBundle *bundle)

◆ lookupKeyForAsset:fromPackage:()

+ (NSString *) lookupKeyForAsset: (NSString*)  asset
fromPackage: (NSString*)  package 

Returns the file name for the given asset which originates from the specified package. The returned file name can be used to access the asset in the application's main bundle.

Parameters
assetThe name of the asset. The name can be hierarchical.
packageThe name of the package from which the asset originates.
Returns
the file name to be used for lookup in the main bundle.

Definition at line 278 of file FlutterDartProject.mm.

References lookupKeyForAsset:fromPackage:fromBundle:.

Referenced by FlutterViewController::lookupKeyForAsset:fromPackage:, and FlutterEngine::run.

278  :(NSString*)asset fromPackage:(NSString*)package {
279  return [self lookupKeyForAsset:asset fromPackage:package fromBundle:nil];
280 }

◆ lookupKeyForAsset:fromPackage:fromBundle:()

+ (NSString *) lookupKeyForAsset: (NSString*)  asset
fromPackage: (NSString*)  package
fromBundle: (nullable NSBundle*)  bundle 

Returns the file name for the given asset which originates from the specified package. The returned file name can be used to access the asset in the specified bundle.

Parameters
assetThe name of the asset. The name can be hierarchical.
packageThe name of the package from which the asset originates.
bundleThe bundle to use when doing the lookup.
Returns
the file name to be used for lookup in the main bundle.

Definition at line 282 of file FlutterDartProject.mm.

References lookupKeyForAsset:fromBundle:.

Referenced by lookupKeyForAsset:fromPackage:.

282  :(NSString*)asset
283  fromPackage:(NSString*)package
284  fromBundle:(nullable NSBundle*)bundle {
285  return [self lookupKeyForAsset:[NSString stringWithFormat:@"packages/%@/%@", package, asset]
286  fromBundle:bundle];
287 }

◆ runConfiguration()

- (RunConfiguration FlutterDartProject()):
implementation

◆ runConfigurationForEntrypoint:()

- (RunConfiguration FlutterDartProject()): (nullable NSString *)  entrypointOrNil
implementation

◆ runConfigurationForEntrypoint:libraryOrNil:()

- (RunConfiguration FlutterDartProject()): (nullable NSString *)  entrypointOrNil
libraryOrNil: (nullable NSString *)  dartLibraryOrNil 
implementation

◆ setPersistentIsolateData:()

- (void) setPersistentIsolateData: (NSData *)  data
implementation

The embedder can specify data that the isolate can request synchronously on launch. Engines launched using this configuration can access the persistent isolate data via the Window.getPersistentIsolateData accessor.

Parameters
dataThe persistent isolate data. This data is persistent for the duration of the Flutter application and is available even after isolate restarts. Because of this lifecycle, the size of this data must be kept to a minimum and platform channels used for communication that does not require synchronous embedder to isolate communication close to isolate launch.

◆ settings()

- (const Settings& FlutterDartProject()):
implementation

Property Documentation

◆ assetsPath

- (NSString*) assetsPath
readnonatomicassignimplementation

The path to the Flutter assets directory.

Definition at line 21 of file FlutterDartProject_Internal.h.

◆ dartEntrypointArguments

- (NSArray<NSString*>*) dartEntrypointArguments
readwritenonatomicassign

An NSArray of NSStrings to be passed as command line arguments to the Dart entrypoint.

If this is not explicitly set, this will default to the contents of [NSProcessInfo arguments], without the binary name.

Set this to nil to pass no arguments to the Dart entrypoint.

Definition at line 47 of file FlutterDartProject.h.

◆ enableMirrors

- (bool) enableMirrors
readwritenonatomicassign

If set, allows the Flutter project to use the dart:mirrors library.

Deprecated: This function is temporary and will be removed in a future release.

Definition at line 37 of file FlutterDartProject.h.

◆ ICUDataPath

- (NSString*) ICUDataPath
readnonatomicassignimplementation

The path to the ICU data file.

Definition at line 26 of file FlutterDartProject_Internal.h.

◆ switches

- (vector<)std:
readnonatomicassignimplementation

The command line arguments array for the engine.

Definition at line 31 of file FlutterDartProject_Internal.h.


The documentation for this class was generated from the following files: