| 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)
const G_MODULE_EXPORT gchar * | fl_dart_project_get_aot_library_path (FlDartProject *self)
G_MODULE_EXPORT void | fl_dart_project_set_assets_path (FlDartProject *self, gchar *path)
const G_MODULE_EXPORT gchar * | fl_dart_project_get_assets_path (FlDartProject *self)
G_MODULE_EXPORT void | fl_dart_project_set_icu_data_path (FlDartProject *self, gchar *path)
const G_MODULE_EXPORT 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)

## Function Documentation

## ◆ fl_dart_project_class_init()

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

Definition at line 44 of file fl_dart_project.cc.

44 {
45 G_OBJECT_CLASS(klass)->dispose = fl_dart_project_dispose;
46 }

References fl_dart_project_dispose().

## ◆ fl_dart_project_dispose()

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

Definition at line 33 of file fl_dart_project.cc.

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

Referenced by fl_dart_project_class_init().

## ◆ fl_dart_project_get_aot_library_path()

const G_MODULE_EXPORT 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 72 of file fl_dart_project.cc.

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

Referenced by fl_engine_start(), and TEST().

## ◆ fl_dart_project_get_assets_path()

const G_MODULE_EXPORT 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 85 of file fl_dart_project.cc.

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

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 104 of file fl_dart_project.cc.

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

Referenced by fl_engine_start(), and TEST().

## ◆ fl_dart_project_get_icu_data_path()

const G_MODULE_EXPORT 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 98 of file fl_dart_project.cc.

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

Referenced by fl_engine_start(), and TEST().

## ◆ fl_dart_project_init()

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

Definition at line 48 of file fl_dart_project.cc.

48 {}

## ◆ 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 50 of file fl_dart_project.cc.

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

References get_executable_dir().

Referenced by make_mock_engine(), 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 65 of file fl_dart_project.cc.

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

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 78 of file fl_dart_project.cc.

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

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 110 of file fl_dart_project.cc.

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

Referenced by 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 91 of file fl_dart_project.cc.

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

Referenced by TEST().

## ◆ get_executable_dir()

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

Definition at line 21 of file fl_dart_project.cc.

21 {
22 g_autoptr(GError) error = nullptr;
23 g_autofree gchar* exe_path = g_file_read_link("/proc/self/exe", &error);
24 if (exe_path == nullptr) {
25 g_critical("Failed to determine location of executable: %s",
26 error->message);
27 return nullptr;
28 }
29
30 return g_path_get_dirname(exe_path);
31 }

References error.

Referenced by fl_dart_project_new().

get_executable_dir
static gchar * get_executable_dir()
Definition: fl_dart_project.cc:21
fl_dart_project_dispose
static void fl_dart_project_dispose(GObject *object)
Definition: fl_dart_project.cc:33
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40