mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Instead of a hand-rolled discriminated union (originally used to avoid a C++17 dependency, which is no longer an issue), implement EncodableValue as a std::variant. Rather than simply changing the internals, this makes EncodableValue a minimal std::variant subclass with only a handful of added methodS, replacing the old IsFoo/FooValue APIs with the standard std::holds_alternative/std::get, so that plugin code will use a standard-based API rather than a Flutter-specific API for wrapped values. This is a breaking change for Windows and GLFW plugins. In the short term USE_LEGACY_ENCODABLE_VALUE can be set in builds to use the old version, to separate rolling from updating. Fixes https://github.com/flutter/flutter/issues/61970
This code is intended to be built into plugins and applications to provide higher-level, C++ abstractions for interacting with the Flutter library. Over time, the goal is to move more of this code into the library in a way that provides a usable ABI (e.g., does not use standard library in the interfaces). Note that this wrapper is still in early stages. Expect significant churn in both the APIs and the structure of the wrapper (e.g., the exact set of files that need to be built).