Flutter macOS Embedder
FlutterDartProject Class Reference

#import <FlutterDartProject.h>

Inheritance diagram for FlutterDartProject:

Instance Methods

(instancetype) - initWithPrecompiledDartBundle:
 
("Use -init instead.") - FLUTTER_UNAVAILABLE
 
(NSArray< NSString * > *dartEntrypointArguments) - API_UNAVAILABLE
 

Class Methods

(NSString *) + defaultBundleIdentifier
 
(NSString *) + lookupKeyForAsset:
 
(NSString *) + lookupKeyForAsset:fromBundle:
 
(NSString *) + lookupKeyForAsset:fromPackage:
 
(NSString *) + lookupKeyForAsset:fromPackage:fromBundle:
 

Detailed Description

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

Definition at line 24 of file FlutterDartProject.mm.

Method Documentation

◆ API_UNAVAILABLE

- (NSArray<NSString*>* dartEntrypointArguments) API_UNAVAILABLE (ios) 

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.

◆ defaultBundleIdentifier

+ (NSString *) defaultBundleIdentifier

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

Definition at line 136 of file FlutterDartProject.mm.

136  {
137  return kAppBundleIdentifier;
138 }

References kAppBundleIdentifier.

◆ FLUTTER_UNAVAILABLE

- ("Use -init instead.") FLUTTER_UNAVAILABLE

Unavailable - use init instead.

◆ initWithPrecompiledDartBundle:

- (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.

◆ 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: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 116 of file FlutterDartProject.mm.

116  :(NSString*)asset {
117  return [self lookupKeyForAsset:asset fromBundle:nil];
118 }

References lookupKeyForAsset:fromBundle:.

◆ 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 120 of file FlutterDartProject.mm.

120  :(NSString*)asset fromBundle:(nullable NSBundle*)bundle {
121  NSString* flutterAssetsName = [FlutterDartProject flutterAssetsNameWithBundle:bundle];
122  return [NSString stringWithFormat:@"%@/%@", flutterAssetsName, asset];
123 }

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

◆ 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 125 of file FlutterDartProject.mm.

125  :(NSString*)asset fromPackage:(NSString*)package {
126  return [self lookupKeyForAsset:asset fromPackage:package fromBundle:nil];
127 }

References lookupKeyForAsset:fromPackage:fromBundle:.

◆ 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 129 of file FlutterDartProject.mm.

129  :(NSString*)asset
130  fromPackage:(NSString*)package
131  fromBundle:(nullable NSBundle*)bundle {
132  return [self lookupKeyForAsset:[NSString stringWithFormat:@"packages/%@/%@", package, asset]
133  fromBundle:bundle];
134 }

References lookupKeyForAsset:fromBundle:.

Referenced by lookupKeyForAsset:fromPackage:.


The documentation for this class was generated from the following files:
kAppBundleIdentifier
static NSString *const kAppBundleIdentifier
Definition: FlutterDartProject.mm:13
FlutterDartProject
Definition: FlutterDartProject.mm:24