5#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterDartProject.h"
6#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterDartProject_Internal.h"
10#include "flutter/shell/platform/common/engine_switches.h"
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- (NSString*)assetsPath {
77 NSBundle* assetBundle = _dartBundle ?: [NSBundle mainBundle];
78 NSString* flutterAssetsName = [assetBundle objectForInfoDictionaryKey:@"FLTAssetsPath"];
79 if (flutterAssetsName == nil) {
80 flutterAssetsName =
@"flutter_assets";
82 NSString*
path = [assetBundle pathForResource:flutterAssetsName ofType:@""];
84 NSLog(
@"Failed to find path for \"%@\
"", flutterAssetsName);
89- (NSString*)ICUDataPath {
94 NSString*
path = [[NSBundle bundleForClass:[
self class]] pathForResource:kICUBundlePath
102+ (NSString*)flutterAssetsNameWithBundle:(NSBundle*)bundle {
107 bundle = [NSBundle mainBundle];
109 NSString* flutterAssetsName = [bundle objectForInfoDictionaryKey:@"FLTAssetsPath"];
110 if (flutterAssetsName == nil) {
111 flutterAssetsName =
@"Contents/Frameworks/App.framework/Resources/flutter_assets";
113 return flutterAssetsName;
116+ (NSString*)lookupKeyForAsset:(NSString*)asset {
117 return [
self lookupKeyForAsset:asset fromBundle:nil];
120+ (NSString*)lookupKeyForAsset:(NSString*)asset fromBundle:(nullable NSBundle*)bundle {
122 return [NSString stringWithFormat:@"%@/%@", flutterAssetsName, asset];
125+ (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package {
126 return [
self lookupKeyForAsset:asset fromPackage:package fromBundle:nil];
129+ (NSString*)lookupKeyForAsset:(NSString*)asset
130 fromPackage:(NSString*)package
131 fromBundle:(nullable NSBundle*)bundle {
132 return [
self lookupKeyForAsset:[NSString stringWithFormat:@"packages/%@/%@", package, asset]
136+ (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