15 #pragma mark - Private interface declaration.
21 + (NSString*)flutterAssetsNameWithBundle:(NSBundle*)bundle;
25 NSBundle* _dartBundle;
30 - (instancetype)init {
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 {
120 + (NSString*)lookupKeyForAsset:(NSString*)asset fromBundle:(nullable NSBundle*)bundle {
121 NSString* flutterAssetsName = [
FlutterDartProject flutterAssetsNameWithBundle:bundle];
122 return [NSString stringWithFormat:@"%@/%@", flutterAssetsName, asset];
125 + (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package {
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 {