| Flutter iOS Embedder |

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 #import <TargetConditionals.h>
10
11 #import "FlutterMacros.h"
12
13 NS_ASSUME_NONNULL_BEGIN
14
15 /**
16 * A set of Flutter and Dart assets used by a `FlutterEngine` to initialize execution.
17 *
18 */
19 FLUTTER_DARWIN_EXPORT
20 @interface FlutterDartProject : NSObject
21
22 /**
23 * Initializes a Flutter Dart project from a bundle.
24 *
25 * The bundle must either contain a flutter_assets resource directory, or set the Info.plist key
26 * FLTAssetsPath to override that name (if you are doing a custom build using a different name).
27 *
28 * @param bundle The bundle containing the Flutter assets directory. If nil, the App framework
29 * created by Flutter will be used.
30 */
31 - (instancetype)initWithPrecompiledDartBundle:(nullable NSBundle*)bundle NS_DESIGNATED_INITIALIZER;
32 /**
33 * Unavailable - use `init` instead.
34 */
35 - (instancetype)initFromDefaultSourceForConfiguration API_UNAVAILABLE(macos)
36 FLUTTER_UNAVAILABLE("Use -init instead.");
37
38 /**
39 * Returns the default identifier for the bundle where we expect to find the Flutter Dart
40 * application.
41 */
42 + (NSString*)defaultBundleIdentifier;
43
44 /**
45 * An NSArray of NSStrings to be passed as command line arguments to the Dart entrypoint.
46 *
47 * If this is not explicitly set, this will default to the contents of
48 * [NSProcessInfo arguments], without the binary name.
49 *
50 * Set this to nil to pass no arguments to the Dart entrypoint.
51 */
52 @property(nonatomic, nullable, copy)
53 NSArray<NSString*>* dartEntrypointArguments API_UNAVAILABLE(ios);
54
55 /**
56 * Returns the file name for the given asset. If the bundle with the identifier
57 * "io.flutter.flutter.app" exists, it will try use that bundle; otherwise, it
58 * will use the main bundle. To specify a different bundle, use
59 * `+lookupKeyForAsset:fromBundle`.
60 *
61 * @param asset The name of the asset. The name can be hierarchical.
62 * @return the file name to be used for lookup in the main bundle.
63 */
64 + (NSString*)lookupKeyForAsset:(NSString*)asset;
65
66 /**
67 * Returns the file name for the given asset.
68 * The returned file name can be used to access the asset in the supplied bundle.
69 *
70 * @param asset The name of the asset. The name can be hierarchical.
71 * @param bundle The `NSBundle` to use for looking up the asset.
72 * @return the file name to be used for lookup in the main bundle.
73 */
74 + (NSString*)lookupKeyForAsset:(NSString*)asset fromBundle:(nullable NSBundle*)bundle;
75
76 /**
77 * Returns the file name for the given asset which originates from the specified package.
78 * The returned file name can be used to access the asset in the application's main bundle.
79 *
80 * @param asset The name of the asset. The name can be hierarchical.
81 * @param package The name of the package from which the asset originates.
82 * @return the file name to be used for lookup in the main bundle.
83 */
84 + (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package;
85
86 /**
87 * Returns the file name for the given asset which originates from the specified package.
88 * The returned file name can be used to access the asset in the specified bundle.
89 *
90 * @param asset The name of the asset. The name can be hierarchical.
91 * @param package The name of the package from which the asset originates.
92 * @param bundle The bundle to use when doing the lookup.
93 * @return the file name to be used for lookup in the main bundle.
94 */
95 + (NSString*)lookupKeyForAsset:(NSString*)asset
96 fromPackage:(NSString*)package
97 fromBundle:(nullable NSBundle*)bundle;
98
99 @end
100
101 NS_ASSUME_NONNULL_END
102
103 #endif // FLUTTER_FLUTTERDARTPROJECT_H_
+[FlutterDartProject defaultBundleIdentifier]
NSString * defaultBundleIdentifier()
Definition: FlutterDartProject.mm:409
NS_ASSUME_NONNULL_END
#define NS_ASSUME_NONNULL_END
Definition: FlutterMacros.h:20
NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_BEGIN
Definition: FlutterMacros.h:19
FlutterMacros.h
-[FlutterDartProject API_UNAVAILABLE]
NSArray< NSString * > *dartEntrypointArguments API_UNAVAILABLE(ios)
FLUTTER_UNAVAILABLE
#define FLUTTER_UNAVAILABLE(msg)
Definition: FlutterMacros.h:38
FLUTTER_DARWIN_EXPORT
#define FLUTTER_DARWIN_EXPORT
Definition: FlutterMacros.h:14
FlutterDartProject
Definition: FlutterDartProject.mm:262