• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "FlutterMacros.h"
11 
12 /**
13  * A set of Flutter and Dart assets used by a `FlutterEngine` to initialize execution.
14  */
15 FLUTTER_EXPORT
16 @interface FlutterDartProject : NSObject
17 
18 /**
19  * Initializes a Flutter Dart project from a bundle.
20  */
21 - (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle NS_DESIGNATED_INITIALIZER;
22 
23 /**
24  * Unavailable - use `init` instead.
25  */
26 - (instancetype)initFromDefaultSourceForConfiguration FLUTTER_UNAVAILABLE("Use -init instead.");
27 
28 /**
29  * Returns the file name for the given asset. If the bundle with the identifier
30  * "io.flutter.flutter.app" exists, it will try use that bundle; otherwise, it
31  * will use the main bundle.  To specify a different bundle, use
32  * `-lookupKeyForAsset:asset:fromBundle`.
33  *
34  * @param asset The name of the asset. The name can be hierarchical.
35  * @return the file name to be used for lookup in the main bundle.
36  */
37 + (NSString*)lookupKeyForAsset:(NSString*)asset;
38 
39 /**
40  * Returns the file name for the given asset.
41  * The returned file name can be used to access the asset in the supplied bundle.
42  *
43  * @param asset The name of the asset. The name can be hierarchical.
44  * @param bundle The `NSBundle` to use for looking up the asset.
45  * @return the file name to be used for lookup in the main bundle.
46  */
47 + (NSString*)lookupKeyForAsset:(NSString*)asset fromBundle:(NSBundle*)bundle;
48 
49 /**
50  * Returns the file name for the given asset which originates from the specified package.
51  * The returned file name can be used to access the asset in the application's main bundle.
52  *
53  * @param asset The name of the asset. The name can be hierarchical.
54  * @param package The name of the package from which the asset originates.
55  * @return the file name to be used for lookup in the main bundle.
56  */
57 + (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package;
58 
59 /**
60  * Returns the file name for the given asset which originates from the specified package.
61  * The returned file name can be used to access the asset in the specified bundle.
62  *
63  * @param asset The name of the asset. The name can be hierarchical.
64  * @param package The name of the package from which the asset originates.
65  * @param bundle The bundle to use when doing the lookup.
66  * @return the file name to be used for lookup in the main bundle.
67  */
68 + (NSString*)lookupKeyForAsset:(NSString*)asset
69                    fromPackage:(NSString*)package
70                     fromBundle:(NSBundle*)bundle;
71 
72 /**
73  * Returns the default identifier for the bundle where we expect to find the Flutter Dart
74  * application.
75  */
76 + (NSString*)defaultBundleIdentifier;
77 
78 @end
79 
80 #endif  // FLUTTER_FLUTTERDARTPROJECT_H_
81