| Flutter Linux Embedder |

Classes | Functions
fl_dart_project.cc File Reference
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_dart_project.h"`
`#include <gmodule.h>`

Go to the source code of this file.

## Classes
struct | _FlDartProject

## Functions
static gchar * | get_executable_dir ()
static void | fl_dart_project_dispose (GObject *object)
static void | fl_dart_project_class_init (FlDartProjectClass *klass)
static void | fl_dart_project_init (FlDartProject *self)
G_MODULE_EXPORT FlDartProject * | fl_dart_project_new ()
G_MODULE_EXPORT void | fl_dart_project_set_aot_library_path (FlDartProject *self, const gchar *path)
G_MODULE_EXPORT const gchar * | fl_dart_project_get_aot_library_path (FlDartProject *self)
G_MODULE_EXPORT void | fl_dart_project_set_assets_path (FlDartProject *self, gchar *path)
G_MODULE_EXPORT const gchar * | fl_dart_project_get_assets_path (FlDartProject *self)
G_MODULE_EXPORT void | fl_dart_project_set_icu_data_path (FlDartProject *self, gchar *path)
G_MODULE_EXPORT const gchar * | fl_dart_project_get_icu_data_path (FlDartProject *self)
G_MODULE_EXPORT gchar ** | fl_dart_project_get_dart_entrypoint_arguments (FlDartProject *self)
G_MODULE_EXPORT void | fl_dart_project_set_dart_entrypoint_arguments (FlDartProject *self, char **argv)
G_MODULE_EXPORT void | fl_dart_project_set_ui_thread_policy (FlDartProject *project, FlUIThreadPolicy policy)
G_MODULE_EXPORT FlUIThreadPolicy | fl_dart_project_get_ui_thread_policy (FlDartProject *project)

## Function Documentation

## ◆ fl_dart_project_class_init()

static void fl_dart_project_class_init | ( | FlDartProjectClass * | klass | ) |
| static

Definition at line 46 of file fl_dart_project.cc.

46 {
47 G_OBJECT_CLASS(klass)->dispose = fl_dart_project_dispose;
48 }
fl_dart_project_dispose
static void fl_dart_project_dispose(GObject *object)
Definition: fl_dart_project.cc:35

References fl_dart_project_dispose().

## ◆ fl_dart_project_dispose()

static void fl_dart_project_dispose | ( | GObject * | object | ) |
| static

Definition at line 35 of file fl_dart_project.cc.

35 {
36 FlDartProject* self = FL_DART_PROJECT(object);
37
38 g_clear_pointer(&self->aot_library_path, g_free);
39 g_clear_pointer(&self->assets_path, g_free);
40 g_clear_pointer(&self->icu_data_path, g_free);
41 g_clear_pointer(&self->dart_entrypoint_args, g_strfreev);
42
43 G_OBJECT_CLASS(fl_dart_project_parent_class)->dispose(object);
44 }

Referenced by fl_dart_project_class_init().

## ◆ fl_dart_project_get_aot_library_path()

G_MODULE_EXPORT const gchar* fl_dart_project_get_aot_library_path | ( | FlDartProject * | project | ) |

fl_dart_project_get_aot_library_path: @project: an #FlDartProject.

Gets the path to the AOT library in the Flutter application.

Returns: (type filename): an absolute file path, e.g. "/projects/my_dart_project/lib/libapp.so".

Definition at line 74 of file fl_dart_project.cc.

75 {
76 g_return_val_if_fail(FL_IS_DART_PROJECT(self), nullptr);
77 return self->aot_library_path;
78 }

Referenced by fl_engine_start(), and TEST().

## ◆ fl_dart_project_get_assets_path()

G_MODULE_EXPORT const gchar* fl_dart_project_get_assets_path | ( | FlDartProject * | project | ) |

fl_dart_project_get_assets_path: @project: an #FlDartProject.

Gets the path to the directory containing the assets used in the Flutter application.

Returns: (type filename): an absolute directory path, e.g. "/projects/my_dart_project/data/flutter_assets".

Definition at line 87 of file fl_dart_project.cc.

88 {
89 g_return_val_if_fail(FL_IS_DART_PROJECT(self), nullptr);
90 return self->assets_path;
91 }

Referenced by fl_engine_start(), and TEST().

## ◆ fl_dart_project_get_dart_entrypoint_arguments()

G_MODULE_EXPORT gchar** fl_dart_project_get_dart_entrypoint_arguments | ( | FlDartProject * | project | ) |

fl_dart_project_get_dart_entrypoint_arguments: @project: an #FlDartProject.

Gets the command line arguments to be passed through to the Dart entrypoint function.

Returns: a NULL-terminated array of strings containing the command line arguments to be passed to the Dart entrypoint.

Definition at line 106 of file fl_dart_project.cc.

107 {
108 g_return_val_if_fail(FL_IS_DART_PROJECT(self), nullptr);
109 return self->dart_entrypoint_args;
110 }

Referenced by fl_engine_start(), and TEST().

## ◆ fl_dart_project_get_icu_data_path()

G_MODULE_EXPORT const gchar* fl_dart_project_get_icu_data_path | ( | FlDartProject * | project | ) |

fl_dart_project_get_icu_data_path: @project: an #FlDartProject.

Gets the path to the ICU data file in the Flutter application.

Returns: (type filename): an absolute file path, e.g. "/projects/my_dart_project/data/icudtl.dat".

Definition at line 100 of file fl_dart_project.cc.

101 {
102 g_return_val_if_fail(FL_IS_DART_PROJECT(self), nullptr);
103 return self->icu_data_path;
104 }

Referenced by fl_engine_start(), and TEST().

## ◆ fl_dart_project_get_ui_thread_policy()

G_MODULE_EXPORT FlUIThreadPolicy fl_dart_project_get_ui_thread_policy | ( | FlDartProject * | project | ) |

fl_dart_project_get_ui_thread_policy: @project: an #FlDartProject.

Returns: the thread policy used for running the UI isolate.

Definition at line 128 of file fl_dart_project.cc.

128 {
129 g_return_val_if_fail(FL_IS_DART_PROJECT(project),
130 FL_UI_THREAD_POLICY_DEFAULT);
131 return project->ui_thread_policy;
132 }
FL_UI_THREAD_POLICY_DEFAULT
@ FL_UI_THREAD_POLICY_DEFAULT
Definition: fl_dart_project.h:142

References FL_UI_THREAD_POLICY_DEFAULT.

Referenced by fl_engine_start().

## ◆ fl_dart_project_init()

static void fl_dart_project_init | ( | FlDartProject * | self | ) |
| static

Definition at line 50 of file fl_dart_project.cc.

50 {}

## ◆ fl_dart_project_new()

G_MODULE_EXPORT FlDartProject* fl_dart_project_new | ( |  | ) |

FlDartProject:

#FlDartProject represents a Dart project. It is used to provide information about the application when creating an #FlView. fl_dart_project_new:

Creates a Flutter project for the currently running executable. The following data files are required relative to the location of the executable:

- data/flutter_assets/ (as built by the Flutter tool).
- data/icudtl.dat (provided as a resource by the Flutter tool).
- lib/libapp.so (as built by the Flutter tool when in AOT mode).

Returns: a new #FlDartProject.

Definition at line 52 of file fl_dart_project.cc.

52 {
53 FlDartProject* self =
54 FL_DART_PROJECT(g_object_new(fl_dart_project_get_type(), nullptr));
55
56 g_autofree gchar* executable_dir = get_executable_dir();
57 self->aot_library_path =
58 g_build_filename(executable_dir, "lib", "libapp.so", nullptr);
59 self->assets_path =
60 g_build_filename(executable_dir, "data", "flutter_assets", nullptr);
61 self->icu_data_path =
62 g_build_filename(executable_dir, "data", "icudtl.dat", nullptr);
63
64 return self;
65 }
get_executable_dir
static gchar * get_executable_dir()
Definition: fl_dart_project.cc:23

References get_executable_dir().

Referenced by fl_application_activate(), fl_engine_new_with_binary_messenger(), and TEST().

## ◆ fl_dart_project_set_aot_library_path()

G_MODULE_EXPORT void fl_dart_project_set_aot_library_path | ( | FlDartProject * | project,
|  | const gchar * | path
| ) |  |

fl_dart_project_set_aot_library_path: @project: an #FlDartProject. @path: the absolute path to the AOT library in the Flutter application.

Sets the path to the AOT library in the Flutter application, which is the path to libapp.so. By default this is lib/libapp.so relative to the executable directory.

Definition at line 67 of file fl_dart_project.cc.

68 {
69 g_return_if_fail(FL_IS_DART_PROJECT(self));
70 g_clear_pointer(&self->aot_library_path, g_free);
71 self->aot_library_path = g_strdup(path);
72 }

Referenced by TEST().

## ◆ fl_dart_project_set_assets_path()

G_MODULE_EXPORT void fl_dart_project_set_assets_path | ( | FlDartProject * | project,
|  | gchar * | path
| ) |  |

fl_dart_project_set_assets_path: @project: an #FlDartProject. @path: the absolute path to the assets directory.

Sets the path to the directory containing the assets used in the Flutter application. By default, this is the data/flutter_assets subdirectory relative to the executable directory.

Definition at line 80 of file fl_dart_project.cc.

81 {
82 g_return_if_fail(FL_IS_DART_PROJECT(self));
83 g_clear_pointer(&self->assets_path, g_free);
84 self->assets_path = g_strdup(path);
85 }

Referenced by TEST().

## ◆ fl_dart_project_set_dart_entrypoint_arguments()

G_MODULE_EXPORT void fl_dart_project_set_dart_entrypoint_arguments | ( | FlDartProject * | project,
|  | char ** | argv
| ) |  |

fl_dart_project_set_dart_entrypoint_arguments: @project: an #FlDartProject. @argv: a pointer to a NULL-terminated array of C strings containing the command line arguments.

Sets the command line arguments to be passed through to the Dart entrypoint function.

Definition at line 112 of file fl_dart_project.cc.

114 {
115 g_return_if_fail(FL_IS_DART_PROJECT(self));
116 g_clear_pointer(&self->dart_entrypoint_args, g_strfreev);
117 self->dart_entrypoint_args = g_strdupv(argv);
118 }

Referenced by fl_application_activate(), and TEST().

## ◆ fl_dart_project_set_icu_data_path()

G_MODULE_EXPORT void fl_dart_project_set_icu_data_path | ( | FlDartProject * | project,
|  | gchar * | path
| ) |  |

fl_dart_project_set_icu_data_path: @project: an #FlDartProject. @path: the absolute path to the ICU data file.

Sets the path to the ICU data file used in the Flutter application. By default, this is data/icudtl.dat relative to the executable directory.

Definition at line 93 of file fl_dart_project.cc.

94 {
95 g_return_if_fail(FL_IS_DART_PROJECT(self));
96 g_clear_pointer(&self->icu_data_path, g_free);
97 self->icu_data_path = g_strdup(path);
98 }

Referenced by TEST().

## ◆ fl_dart_project_set_ui_thread_policy()

G_MODULE_EXPORT void fl_dart_project_set_ui_thread_policy | ( | FlDartProject * | project,
|  | FlUIThreadPolicy | policy
| ) |  |

fl_dart_project_set_ui_thread_policy: @project: an #FlDartProject. @policy: the thread policy to use for running the UI isolate.

Definition at line 121 of file fl_dart_project.cc.

122 {
123 g_return_if_fail(FL_IS_DART_PROJECT(project));
124 project->ui_thread_policy = policy;
125 }

Referenced by TEST().

## ◆ get_executable_dir()

static gchar* get_executable_dir | ( |  | ) |
| static

Definition at line 23 of file fl_dart_project.cc.

23 {
24 g_autoptr(GError) error = nullptr;
25 g_autofree gchar* exe_path = g_file_read_link("/proc/self/exe", &error);
26 if (exe_path == nullptr) {
27 g_critical("Failed to determine location of executable: %s",
28 error->message);
29 return nullptr;
30 }
31
32 return g_path_get_dirname(exe_path);
33 }
g_autoptr
g_autoptr(GMutexLocker) locker
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40

References error, and g_autoptr().

Referenced by fl_dart_project_new().