Flutter Engine
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_WINDOWS_CLIENT_WRAPPER_INCLUDE_FLUTTER_DART_PROJECT_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_CLIENT_WRAPPER_INCLUDE_FLUTTER_DART_PROJECT_H_
7 
8 #include <string>
9 #include <vector>
10 
11 namespace flutter {
12 
13 // A set of Flutter and Dart assets used to initialize a Flutter engine.
14 class DartProject {
15  public:
16  // Creates a DartProject from a directory path. The directory should contain
17  // the following top-level items:
18  // - icudtl.dat (provided as a resource by the Flutter tool)
19  // - flutter_assets (as built by the Flutter tool)
20  // - app.so, for an AOT build (as built by the Flutter tool)
21  //
22  // The path can either be absolute, or relative to the directory containing
23  // the running executable.
24  explicit DartProject(const std::wstring& path) {
25  assets_path_ = path + L"\\flutter_assets";
26  icu_data_path_ = path + L"\\icudtl.dat";
27  aot_library_path_ = path + L"\\app.so";
28  }
29 
30  ~DartProject() = default;
31 
32  private:
33  // Accessors for internals are private, so that they can be changed if more
34  // flexible options for project structures are needed later without it
35  // being a breaking change. Provide access to internal classes that need
36  // them.
37  friend class FlutterEngine;
38  friend class FlutterViewController;
39  friend class DartProjectTest;
40 
41  const std::wstring& assets_path() const { return assets_path_; }
42  const std::wstring& icu_data_path() const { return icu_data_path_; }
43  const std::wstring& aot_library_path() const { return aot_library_path_; }
44 
45  // The path to the assets directory.
46  std::wstring assets_path_;
47  // The path to the ICU data.
48  std::wstring icu_data_path_;
49  // The path to the AOT library. This will always return a path, but non-AOT
50  // builds will not be expected to actually have a library at that path.
51  std::wstring aot_library_path_;
52 };
53 
54 } // namespace flutter
55 
56 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_CLIENT_WRAPPER_INCLUDE_FLUTTER_DART_PROJECT_H_
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
DartProject(const std::wstring &path)
Definition: dart_project.h:24