Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
flutter_project_bundle.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_WINDOWS_FLUTTER_PROJECT_BUNDLE_H_
6#define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PROJECT_BUNDLE_H_
7
8#include <filesystem>
9#include <string>
10#include <vector>
11
14
15namespace flutter {
16
18 std::unique_ptr<_FlutterEngineAOTData, FlutterEngineCollectAOTDataFnPtr>;
19
25
31
37
39 Default,
40 Enabled,
42};
43
44// The data associated with a Flutter project needed to run it in an engine.
46 public:
47 // Creates a new project bundle from the given properties.
48 //
49 // Treats any relative paths as relative to the directory of this executable.
50 explicit FlutterProjectBundle(
51 const FlutterDesktopEngineProperties& properties);
52
54
55 // Whether or not the bundle is valid. This does not check that the paths
56 // exist, or contain valid data, just that paths were able to be constructed.
57 bool HasValidPaths();
58
59 // Returns the path to the assets directory.
60 const std::filesystem::path& assets_path() { return assets_path_; }
61
62 // Returns the path to the ICU data file.
63 const std::filesystem::path& icu_path() { return icu_path_; }
64
65 // Returns any switches that should be passed to the engine.
66 const std::vector<std::string> GetSwitches();
67
68 // Sets engine switches.
69 void SetSwitches(const std::vector<std::string>& switches);
70
71 // Attempts to load AOT data for this bundle. The returned data must be
72 // retained until any engine instance it is passed to has been shut down.
73 //
74 // Logs and returns nullptr on failure.
76
77 // Returns the Dart entrypoint.
78 const std::string& dart_entrypoint() const { return dart_entrypoint_; }
79
80 // Returns the command line arguments to be passed through to the Dart
81 // entrypoint.
82 const std::vector<std::string>& dart_entrypoint_arguments() const {
83 return dart_entrypoint_arguments_;
84 }
85
86 // Returns the app's GPU preference.
87 FlutterGpuPreference gpu_preference() const { return gpu_preference_; }
88
89 // Returns thread policy for running the UI isolate.
90 FlutterUIThreadPolicy ui_thread_policy() { return ui_thread_policy_; }
91
92 // Returns the accessibility mode.
94 return accessibility_mode_;
95 }
96
97 // Returns the Impeller enablement switch.
98 FlutterImpellerSwitch impeller_switch() const { return impeller_switch_; }
99
100 private:
101 std::filesystem::path assets_path_;
102 std::filesystem::path icu_path_;
103
104 // Path to the AOT library file, if any.
105 std::filesystem::path aot_library_path_;
106
107 // The Dart entrypoint to launch.
108 std::string dart_entrypoint_;
109
110 // Dart entrypoint arguments.
111 std::vector<std::string> dart_entrypoint_arguments_;
112
113 // Engine switches.
114 std::vector<std::string> engine_switches_;
115
116 // App's GPU preference.
117 FlutterGpuPreference gpu_preference_;
118
119 // Thread policy for running the UI isolate.
120 FlutterUIThreadPolicy ui_thread_policy_;
121
122 // The current accessibility mode.
123 FlutterAccessibilityMode accessibility_mode_;
124
125 // The Impeller enablement switch.
127};
128
129} // namespace flutter
130
131#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_PROJECT_BUNDLE_H_
const std::filesystem::path & assets_path()
FlutterGpuPreference gpu_preference() const
FlutterImpellerSwitch impeller_switch() const
const std::vector< std::string > GetSwitches()
const std::string & dart_entrypoint() const
FlutterAccessibilityMode accessibility_mode() const
const std::vector< std::string > & dart_entrypoint_arguments() const
UniqueAotDataPtr LoadAotData(const FlutterEngineProcTable &engine_procs)
const std::filesystem::path & icu_path()
FlutterUIThreadPolicy ui_thread_policy()
void SetSwitches(const std::vector< std::string > &switches)
std::unique_ptr< _FlutterEngineAOTData, FlutterEngineCollectAOTDataFnPtr > UniqueAotDataPtr
Function-pointer-based versions of the APIs above.
Definition embedder.h:3763