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