mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Standard*Codec allows for extensions to support arbitrary types; this had not previously been implemented for the C++ version. Overview of changes: - EncodableValue's std::variant type now allows for a new CustomEncodableValue, which is a thin wrapper around std::any, to store arbitrary extension types. - ByteBufferStream* has been split into an interface class and the buffer-based implementation, with the former now part of the public API surface to be used in standard codec extensions. - They also gained utility methods for some common data types to simplify writing extensions. - StandardCodecSerializer is now part of the public API surface, and is subclassable. - StandardCodecSerializer's ReadValue has been split into ReadValue and ReadValueOfType to match the structure used when subclassing on the Dart side, for easier porting of custom extensions across languages. - Standard*Codec now optionally accepts a non-default serializer in GetInstance, providing a shared instance using that serializer. Fixes https://github.com/flutter/flutter/issues/31174
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).