Flutter Engine
FlutterDartProject.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_FLUTTERDARTPROJECT_H_
6 #define FLUTTER_FLUTTERDARTPROJECT_H_
7 
8 #import <Foundation/Foundation.h>
9 
10 #import "FlutterMacros.h"
11 
13 
14 /**
15  * A set of Flutter and Dart assets used by a `FlutterEngine` to initialize execution.
16  */
18 @interface FlutterDartProject : NSObject
19 
20 /**
21  * Initializes a Flutter Dart project from a bundle.
22  */
23 - (instancetype)initWithPrecompiledDartBundle:(nullable NSBundle*)bundle NS_DESIGNATED_INITIALIZER;
24 
25 /**
26  * Unavailable - use `init` instead.
27  */
28 - (instancetype)initFromDefaultSourceForConfiguration FLUTTER_UNAVAILABLE("Use -init instead.");
29 
30 /**
31  * Returns the file name for the given asset. If the bundle with the identifier
32  * "io.flutter.flutter.app" exists, it will try use that bundle; otherwise, it
33  * will use the main bundle. To specify a different bundle, use
34  * `-lookupKeyForAsset:asset:fromBundle`.
35  *
36  * @param asset The name of the asset. The name can be hierarchical.
37  * @return the file name to be used for lookup in the main bundle.
38  */
39 + (NSString*)lookupKeyForAsset:(NSString*)asset;
40 
41 /**
42  * Returns the file name for the given asset.
43  * The returned file name can be used to access the asset in the supplied bundle.
44  *
45  * @param asset The name of the asset. The name can be hierarchical.
46  * @param bundle The `NSBundle` to use for looking up the asset.
47  * @return the file name to be used for lookup in the main bundle.
48  */
49 + (NSString*)lookupKeyForAsset:(NSString*)asset fromBundle:(nullable NSBundle*)bundle;
50 
51 /**
52  * Returns the file name for the given asset which originates from the specified package.
53  * The returned file name can be used to access the asset in the application's main bundle.
54  *
55  * @param asset The name of the asset. The name can be hierarchical.
56  * @param package The name of the package from which the asset originates.
57  * @return the file name to be used for lookup in the main bundle.
58  */
59 + (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package;
60 
61 /**
62  * Returns the file name for the given asset which originates from the specified package.
63  * The returned file name can be used to access the asset in the specified bundle.
64  *
65  * @param asset The name of the asset. The name can be hierarchical.
66  * @param package The name of the package from which the asset originates.
67  * @param bundle The bundle to use when doing the lookup.
68  * @return the file name to be used for lookup in the main bundle.
69  */
70 + (NSString*)lookupKeyForAsset:(NSString*)asset
71  fromPackage:(NSString*)package
72  fromBundle:(nullable NSBundle*)bundle;
73 
74 /**
75  * Returns the default identifier for the bundle where we expect to find the Flutter Dart
76  * application.
77  */
78 + (NSString*)defaultBundleIdentifier;
79 
80 @end
81 
83 
84 #endif // FLUTTER_FLUTTERDARTPROJECT_H_
NSString * defaultBundleIdentifier()
#define NS_ASSUME_NONNULL_END
Definition: FlutterMacros.h:20
#define NS_ASSUME_NONNULL_BEGIN
Definition: FlutterMacros.h:19
#define FLUTTER_UNAVAILABLE(msg)
Definition: FlutterMacros.h:38
#define FLUTTER_EXPORT