| Flutter Linux Embedder |

fl_dart_project.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_LINUX_PUBLIC_FLUTTER_LINUX_FL_DART_PROJECT_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_DART_PROJECT_H_
7
8 #include <glib-object.h>
9 #include <gmodule.h>
10
11 #if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION)
12 #error "Only <flutter_linux/flutter_linux.h> can be included directly."
13 #endif
14
15 G_BEGIN_DECLS
16
17 G_MODULE_EXPORT
18 G_DECLARE_FINAL_TYPE(FlDartProject, fl_dart_project, FL, DART_PROJECT, GObject)
19
20 /**
21 * FlDartProject:
22 *
23 * #FlDartProject represents a Dart project. It is used to provide information
24 * about the application when creating an #FlView.
25 */
26
27 /**
28 * fl_dart_project_new:
29 *
30 * Creates a Flutter project for the currently running executable. The following
31 * data files are required relative to the location of the executable:
32 * - data/flutter_assets/ (as built by the Flutter tool).
33 * - data/icudtl.dat (provided as a resource by the Flutter tool).
34 * - lib/libapp.so (as built by the Flutter tool when in AOT mode).
35 *
36 * Returns: a new #FlDartProject.
37 */
38 FlDartProject* fl_dart_project_new();
39
40 /**
41 * fl_dart_project_set_aot_library_path:
42 * @project: an #FlDartProject.
43 * @path: the absolute path to the AOT library in the Flutter application.
44 *
45 * Sets the path to the AOT library in the Flutter application, which is
46 * the path to libapp.so. By default this is lib/libapp.so relative to the
47 * executable directory.
48 */
49 void fl_dart_project_set_aot_library_path(FlDartProject* project,
50 const gchar* path);
51
52 /**
53 * fl_dart_project_get_aot_library_path:
54 * @project: an #FlDartProject.
55 *
56 * Gets the path to the AOT library in the Flutter application.
57 *
58 * Returns: (type filename): an absolute file path, e.g.
59 * "/projects/my_dart_project/lib/libapp.so".
60 */
61 const gchar* fl_dart_project_get_aot_library_path(FlDartProject* project);
62
63 /**
64 * fl_dart_project_set_assets_path:
65 * @project: an #FlDartProject.
66 * @path: the absolute path to the assets directory.
67 *
68 * Sets the path to the directory containing the assets used in the Flutter
69 * application. By default, this is the data/flutter_assets subdirectory
70 * relative to the executable directory.
71 */
72 void fl_dart_project_set_assets_path(FlDartProject* project, gchar* path);
73
74 /**
75 * fl_dart_project_get_assets_path:
76 * @project: an #FlDartProject.
77 *
78 * Gets the path to the directory containing the assets used in the Flutter
79 * application.
80 *
81 * Returns: (type filename): an absolute directory path, e.g.
82 * "/projects/my_dart_project/data/flutter_assets".
83 */
84 const gchar* fl_dart_project_get_assets_path(FlDartProject* project);
85
86 /**
87 * fl_dart_project_set_icu_data_path:
88 * @project: an #FlDartProject.
89 * @path: the absolute path to the ICU data file.
90 *
91 * Sets the path to the ICU data file used in the Flutter application. By
92 * default, this is data/icudtl.dat relative to the executable directory.
93 */
94 void fl_dart_project_set_icu_data_path(FlDartProject* project, gchar* path);
95
96 /**
97 * fl_dart_project_get_icu_data_path:
98 * @project: an #FlDartProject.
99 *
100 * Gets the path to the ICU data file in the Flutter application.
101 *
102 * Returns: (type filename): an absolute file path, e.g.
103 * "/projects/my_dart_project/data/icudtl.dat".
104 */
105 const gchar* fl_dart_project_get_icu_data_path(FlDartProject* project);
106
107 /**
108 * fl_dart_project_set_dart_entrypoint_arguments:
109 * @project: an #FlDartProject.
110 * @argv: a pointer to a NULL-terminated array of C strings containing the
111 * command line arguments.
112 *
113 * Sets the command line arguments to be passed through to the Dart
114 * entrypoint function.
115 */
116 void fl_dart_project_set_dart_entrypoint_arguments(FlDartProject* project,
117 char** argv);
118
119 /**
120 * fl_dart_project_get_dart_entrypoint_arguments:
121 * @project: an #FlDartProject.
122 *
123 * Gets the command line arguments to be passed through to the Dart entrypoint
124 * function.
125 *
126 * Returns: a NULL-terminated array of strings containing the command line
127 * arguments to be passed to the Dart entrypoint.
128 */
129 gchar** fl_dart_project_get_dart_entrypoint_arguments(FlDartProject* project);
130
131 /**
132 * FlUIThreadPolicy:
133 * Configures the thread policy for running the UI isolate.
134 * @FL_UI_THREAD_POLICY_DEFAULT: Defaut value. Currently will run the UI isolate
135 * on separate thread, later will change to run on platform thread.
136 * @FL_UI_THREAD_POLICY_RUN_ON_PLATFORM_THREAD: Run the UI isolate on the
137 * platform thread.
138 * @FL_UI_THREAD_POLICY_RUN_ON_SEPARATE_THREAD: Run the UI isolate on a separate
139 * thread.
140 */
141 typedef enum {
142 FL_UI_THREAD_POLICY_DEFAULT,
143 FL_UI_THREAD_POLICY_RUN_ON_PLATFORM_THREAD,
144 FL_UI_THREAD_POLICY_RUN_ON_SEPARATE_THREAD,
145 } FlUIThreadPolicy;
146
147 /**
148 * fl_dart_project_set_ui_thread_policy:
149 * @project: an #FlDartProject.
150 * @policy: the thread policy to use for running the UI isolate.
151 */
152 void fl_dart_project_set_ui_thread_policy(FlDartProject* project,
153 FlUIThreadPolicy policy);
154
155 /**
156 * fl_dart_project_get_ui_thread_policy:
157 * @project: an #FlDartProject.
158 *
159 * Returns: the thread policy used for running the UI isolate.
160 */
161 FlUIThreadPolicy fl_dart_project_get_ui_thread_policy(FlDartProject* project);
162
163 G_END_DECLS
164
165 #endif // FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_DART_PROJECT_H_
G_DECLARE_FINAL_TYPE
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlAccessibilityChannel, fl_accessibility_channel, FL, ACCESSIBILITY_CHANNEL, GObject)
FL
FL
Definition: fl_binary_messenger.cc:27
fl_dart_project_get_dart_entrypoint_arguments
gchar ** fl_dart_project_get_dart_entrypoint_arguments(FlDartProject *project)
Definition: fl_dart_project.cc:106
fl_dart_project_get_icu_data_path
const gchar * fl_dart_project_get_icu_data_path(FlDartProject *project)
Definition: fl_dart_project.cc:100
fl_dart_project_set_dart_entrypoint_arguments
void fl_dart_project_set_dart_entrypoint_arguments(FlDartProject *project, char **argv)
Definition: fl_dart_project.cc:112
fl_dart_project_set_assets_path
void fl_dart_project_set_assets_path(FlDartProject *project, gchar *path)
Definition: fl_dart_project.cc:80
FlUIThreadPolicy
FlUIThreadPolicy
Definition: fl_dart_project.h:141
FL_UI_THREAD_POLICY_RUN_ON_PLATFORM_THREAD
@ FL_UI_THREAD_POLICY_RUN_ON_PLATFORM_THREAD
Definition: fl_dart_project.h:143
FL_UI_THREAD_POLICY_RUN_ON_SEPARATE_THREAD
@ FL_UI_THREAD_POLICY_RUN_ON_SEPARATE_THREAD
Definition: fl_dart_project.h:144
FL_UI_THREAD_POLICY_DEFAULT
@ FL_UI_THREAD_POLICY_DEFAULT
Definition: fl_dart_project.h:142
fl_dart_project_set_ui_thread_policy
void fl_dart_project_set_ui_thread_policy(FlDartProject *project, FlUIThreadPolicy policy)
Definition: fl_dart_project.cc:121
fl_dart_project_set_aot_library_path
void fl_dart_project_set_aot_library_path(FlDartProject *project, const gchar *path)
Definition: fl_dart_project.cc:67
fl_dart_project_set_icu_data_path
void fl_dart_project_set_icu_data_path(FlDartProject *project, gchar *path)
Definition: fl_dart_project.cc:93
fl_dart_project_get_aot_library_path
const gchar * fl_dart_project_get_aot_library_path(FlDartProject *project)
Definition: fl_dart_project.cc:74
fl_dart_project_get_ui_thread_policy
FlUIThreadPolicy fl_dart_project_get_ui_thread_policy(FlDartProject *project)
Definition: fl_dart_project.cc:128
fl_dart_project_new
G_BEGIN_DECLS G_MODULE_EXPORT FlDartProject * fl_dart_project_new()
Definition: fl_dart_project.cc:52
fl_dart_project_get_assets_path
const gchar * fl_dart_project_get_assets_path(FlDartProject *project)
Definition: fl_dart_project.cc:87