Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
fl_dart_project.h File Reference
#include <glib-object.h>
#include <gmodule.h>

Go to the source code of this file.

Functions

G_BEGIN_DECLS G_MODULE_EXPORT FlDartProject * fl_dart_project_new ()
 
void fl_dart_project_set_aot_library_path (FlDartProject *project, const gchar *path)
 
const gchar * fl_dart_project_get_aot_library_path (FlDartProject *project)
 
void fl_dart_project_set_assets_path (FlDartProject *project, gchar *path)
 
const gchar * fl_dart_project_get_assets_path (FlDartProject *project)
 
void fl_dart_project_set_icu_data_path (FlDartProject *project, gchar *path)
 
const gchar * fl_dart_project_get_icu_data_path (FlDartProject *project)
 
void fl_dart_project_set_dart_entrypoint_arguments (FlDartProject *project, char **argv)
 
gchar ** fl_dart_project_get_dart_entrypoint_arguments (FlDartProject *project)
 

Function Documentation

◆ fl_dart_project_get_aot_library_path()

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 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}

◆ fl_dart_project_get_assets_path()

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 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}

◆ fl_dart_project_get_dart_entrypoint_arguments()

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}

◆ fl_dart_project_get_icu_data_path()

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 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}

◆ fl_dart_project_new()

G_BEGIN_DECLS 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}
static gchar * get_executable_dir()

◆ fl_dart_project_set_aot_library_path()

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}

◆ fl_dart_project_set_assets_path()

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}

◆ fl_dart_project_set_dart_entrypoint_arguments()

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}

◆ fl_dart_project_set_icu_data_path()

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}