15#pragma mark - Private interface declaration.
21+ (NSString*)flutterAssetsNameWithBundle:(NSBundle*)bundle;
25 NSBundle* _dartBundle;
31 return [
self initWithPrecompiledDartBundle:nil];
34- (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle {
36 NSAssert(
self,
@"Super init cannot be nil");
39 if (_dartBundle == nil) {
41 _dartBundle = [NSBundle bundleWithURL:[NSBundle.mainBundle.privateFrameworksURL
42 URLByAppendingPathComponent:@"App.framework"]];
44 if (!_dartBundle.isLoaded) {
47 _dartEntrypointArguments = [[NSProcessInfo processInfo] arguments];
49 _dartEntrypointArguments = [_dartEntrypointArguments
50 subarrayWithRange:NSMakeRange(1, _dartEntrypointArguments.count - 1)];
54- (instancetype)initWithAssetsPath:(NSString*)assets ICUDataPath:(NSString*)icuPath {
56 NSAssert(
self,
@"Super init cannot be nil");
62- (
BOOL)enableImpeller {
63 NSNumber* enableImpeller =
64 [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FLTEnableImpeller"];
65 if (enableImpeller != nil) {
66 return enableImpeller.boolValue;
71- (
BOOL)enableFlutterGPU {
72 NSNumber* enableFlutterGPU =
73 [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FLTEnableFlutterGPU"];
74 if (enableFlutterGPU != nil) {
75 return enableFlutterGPU.boolValue;
80- (NSString*)assetsPath {
86 NSBundle* assetBundle = _dartBundle ?: [NSBundle mainBundle];
87 NSString* flutterAssetsName = [assetBundle objectForInfoDictionaryKey:@"FLTAssetsPath"];
88 if (flutterAssetsName == nil) {
89 flutterAssetsName =
@"flutter_assets";
91 NSString*
path = [assetBundle pathForResource:flutterAssetsName ofType:@""];
93 NSLog(
@"Failed to find path for \"%@\
"", flutterAssetsName);
98- (NSString*)ICUDataPath {
103 NSString*
path = [[NSBundle bundleForClass:[
self class]] pathForResource:kICUBundlePath
111+ (NSString*)flutterAssetsNameWithBundle:(NSBundle*)bundle {
116 bundle = [NSBundle mainBundle];
118 NSString* flutterAssetsName = [bundle objectForInfoDictionaryKey:@"FLTAssetsPath"];
119 if (flutterAssetsName == nil) {
120 flutterAssetsName =
@"Contents/Frameworks/App.framework/Resources/flutter_assets";
122 return flutterAssetsName;
125+ (NSString*)lookupKeyForAsset:(NSString*)asset {
126 return [
self lookupKeyForAsset:asset fromBundle:nil];
129+ (NSString*)lookupKeyForAsset:(NSString*)asset fromBundle:(nullable NSBundle*)bundle {
131 return [NSString stringWithFormat:@"%@/%@", flutterAssetsName, asset];
134+ (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package {
135 return [
self lookupKeyForAsset:asset fromPackage:package fromBundle:nil];
138+ (NSString*)lookupKeyForAsset:(NSString*)asset
139 fromPackage:(NSString*)package
140 fromBundle:(nullable NSBundle*)bundle {
141 return [
self lookupKeyForAsset:[NSString stringWithFormat:@"packages/%@/%@", package, asset]
145+ (NSString*)defaultBundleIdentifier {
NSBundle * FLTFrameworkBundleWithIdentifier(NSString *flutterFrameworkBundleID)
NSString * flutterAssetsNameWithBundle:(NSBundle *bundle)
static NSString *const kAppBundleIdentifier
static NSString *const kICUBundlePath
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path