diff --git a/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java b/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java index 563f91c4347b1c2285e0d26c3238202ef2f2f352..6514dc21b1148a80dacb28ee312336b38cf880fc 100644 --- a/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/BinaryCodec.java @@ -7,7 +7,14 @@ package io.flutter.plugin.common; import java.nio.ByteBuffer; /** - * A {@link MessageCodec} using unencoded binary messages, represented as {@link ByteBuffer}s. + * A {@link MessageCodec} using unencoded binary messages, represented as + * {@link ByteBuffer}s. + * + *

This codec is guaranteed to be compatible with the corresponding + * BinaryCodec + * on the Dart side. These parts of the Flutter SDK are evolved synchronously.

+ * + *

On the Dart side, messages are represented using {@code ByteData}.

*/ public final class BinaryCodec implements MessageCodec { // This codec must match the Dart codec of the same name in package flutter/services. diff --git a/shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java b/shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java index ab284c9753b76aece0abd1e8df37c21a5506d38f..85d14fcc290ee9678d10f76c9596c679c7b8c34e 100644 --- a/shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/JSONMessageCodec.java @@ -12,7 +12,15 @@ import org.json.JSONTokener; /** * A {@link MessageCodec} using UTF-8 encoded JSON messages. * - * Supports the same Java values as {@link JSONObject#wrap(Object)}. + *

This codec is guaranteed to be compatible with the corresponding + * JSONMessageCodec + * on the Dart side. These parts of the Flutter SDK are evolved synchronously.

+ * + *

Supports the same Java values as {@link JSONObject#wrap(Object)}.

+ * + *

On the Dart side, JSON messages are handled by the JSON facilities of the + * dart:convert + * package.

*/ public final class JSONMessageCodec implements MessageCodec { // This codec must match the Dart codec of the same name in package flutter/services. diff --git a/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java b/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java index 263ab2cff39f82cb19a72da20f4a9e81e080e3d0..bd4b52f5914c5d753f3552cea9236f6ff25cdf91 100644 --- a/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/JSONMethodCodec.java @@ -7,8 +7,13 @@ import org.json.JSONObject; /** * A {@link MethodCodec} using UTF-8 encoded JSON method calls and result envelopes. - * Values supported as methods arguments and result payloads are those supported by - * {@link JSONMessageCodec}. + * + *

This codec is guaranteed to be compatible with the corresponding + * JSONMethodCodec + * on the Dart side. These parts of the Flutter SDK are evolved synchronously.

+ * + *

Values supported as methods arguments and result payloads are those supported by + * {@link JSONMessageCodec}.

*/ public final class JSONMethodCodec implements MethodCodec { // This codec must match the Dart codec of the same name in package flutter/services. diff --git a/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java b/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java index 21bd7fa711b7c0f0211fd23fea98138c3ebe7213..29c89685ddfe951e1e0d42dbb0f84e064c1a051b 100644 --- a/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/StandardMessageCodec.java @@ -18,11 +18,11 @@ import java.util.Map.Entry; /** * MessageCodec using the Flutter standard binary encoding. * - * The standard encoding is guaranteed to be compatible with the corresponding standard codec - * for PlatformMessageChannels on the Flutter side. These parts of the Flutter SDK are evolved - * synchronously. + *

This codec is guaranteed to be compatible with the corresponding + * StandardMessageCodec + * on the Dart side. These parts of the Flutter SDK are evolved synchronously.

* - * Supported messages are acyclic values of these forms: + *

Supported messages are acyclic values of these forms:

* * + * + *

On the Dart side, these values are represented as follows:

+ * + * */ public final class StandardMessageCodec implements MessageCodec { - // This codec must match the Dart codec of the same name in package flutter/services. public static final StandardMessageCodec INSTANCE = new StandardMessageCodec(); private StandardMessageCodec() { diff --git a/shell/platform/android/io/flutter/plugin/common/StandardMethodCodec.java b/shell/platform/android/io/flutter/plugin/common/StandardMethodCodec.java index a6a1029510ceb363ff59f8004041d8256907249e..173514a3b449b72a0450324b39c6ba98ae46f6eb 100644 --- a/shell/platform/android/io/flutter/plugin/common/StandardMethodCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/StandardMethodCodec.java @@ -11,15 +11,14 @@ import java.nio.ByteOrder; /** * A {@link MethodCodec} using the Flutter standard binary encoding. * - * The standard codec is guaranteed to be compatible with the corresponding standard codec for - * PlatformMethodChannels on the Flutter side. These parts of the Flutter SDK are evolved - * synchronously. + *

This codec is guaranteed to be compatible with the corresponding + * StandardMethodCodec + * on the Dart side. These parts of the Flutter SDK are evolved synchronously.

* - * Values supported as method arguments and result payloads are those supported by - * {@link StandardMessageCodec}. + *

Values supported as method arguments and result payloads are those supported by + * {@link StandardMessageCodec}.

*/ public final class StandardMethodCodec implements MethodCodec { - // This codec must match the Dart codec of the same name in package flutter/services. public static final StandardMethodCodec INSTANCE = new StandardMethodCodec(); private StandardMethodCodec() { diff --git a/shell/platform/android/io/flutter/plugin/common/StringCodec.java b/shell/platform/android/io/flutter/plugin/common/StringCodec.java index dac376ba0d43462b2549f5bf8ede268bf9c82dea..9851cf4ccf60c54c00229968fd2263394d18c1aa 100644 --- a/shell/platform/android/io/flutter/plugin/common/StringCodec.java +++ b/shell/platform/android/io/flutter/plugin/common/StringCodec.java @@ -9,9 +9,12 @@ import java.nio.charset.Charset; /** * A {@link MessageCodec} using UTF-8 encoded String messages. + * + *

This codec is guaranteed to be compatible with the corresponding + * StringCodec + * on the Dart side. These parts of the Flutter SDK are evolved synchronously.

*/ public final class StringCodec implements MessageCodec { - // This codec must match the Dart codec of the same name in package flutter/services. private static final Charset UTF8 = Charset.forName("UTF8"); public static final StringCodec INSTANCE = new StringCodec(); diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h b/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h index f1c4b2880a083148cdd09005a9cf7b6f8a8d8bb5..89b7e66d14713749146fc66254dfe7bb7ae79fac 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterCodecs.h @@ -40,6 +40,12 @@ FLUTTER_EXPORT /** A `FlutterMessageCodec` using unencoded binary messages, represented as `NSData` instances. + + This codec is guaranteed to be compatible with the corresponding + [BinaryCodec](https://docs.flutter.io/flutter/services/BinaryCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. + + On the Dart side, messages are represented using `ByteData`. */ FLUTTER_EXPORT @interface FlutterBinaryCodec : NSObject @@ -47,6 +53,10 @@ FLUTTER_EXPORT /** A `FlutterMessageCodec` using UTF-8 encoded `NSString` messages. + + This codec is guaranteed to be compatible with the corresponding + [StringCodec](https://docs.flutter.io/flutter/services/StringCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. */ FLUTTER_EXPORT @interface FlutterStringCodec : NSObject @@ -55,7 +65,16 @@ FLUTTER_EXPORT /** A `FlutterMessageCodec` using UTF-8 encoded JSON messages. - Supports the same values as `NSJSONSerialization`. + This codec is guaranteed to be compatible with the corresponding + [JSONMessageCodec](https://docs.flutter.io/flutter/services/JSONMessageCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. + + Supports values accepted by `NSJSONSerialization` plus top-level + `nil`, `NSNumber`, and `NSString`. + + On the Dart side, JSON messages are handled by the JSON facilities of the + [`dart:convert`](https://api.dartlang.org/stable/dart-convert/JSON-constant.html) + package. */ FLUTTER_EXPORT @interface FlutterJSONMessageCodec : NSObject @@ -64,19 +83,29 @@ FLUTTER_EXPORT /** A `FlutterMessageCodec` using the Flutter standard binary encoding. - The standard encoding is guaranteed to be compatible with the corresponding - standard codec for PlatformMessageChannels on the Flutter side. These parts - of the Flutter SDK are evolved synchronously. + This codec is guaranteed to be compatible with the corresponding + [StandardMessageCodec](https://docs.flutter.io/flutter/services/StandardMessageCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. Supported messages are acyclic values of these forms: - `nil` or `NSNull` - `NSNumber` (including their representation of Boolean values) - `FlutterStandardBigInteger` - - `FlutterStandardTypedData` - `NSString` + - `FlutterStandardTypedData` - `NSArray` of supported values - `NSDictionary` with supported keys and values + + On the Dart side, these values are represented as follows: + + - `nil` or `NSNull`: `null` + - `NSNumber`: `bool`, `int`, or `double`, depending on the contained value. + - `FlutterStandardBigInteger`: `int` + - `NSString`: `String` + - `FlutterStandardTypedData`: `Uint8List`, `Int32List`, `Int64List`, or `Float64List` + - `NSArray`: `List` + - `NSDictionary`: `Map` */ FLUTTER_EXPORT @interface FlutterStandardMessageCodec : NSObject @@ -308,7 +337,13 @@ FLUTTER_EXPORT /** A `FlutterMethodCodec` using UTF-8 encoded JSON method calls and result - envelopes. Values supported as methods arguments and result payloads are + envelopes. + + This codec is guaranteed to be compatible with the corresponding + [JSONMethodCodec](https://docs.flutter.io/flutter/services/JSONMethodCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. + + Values supported as methods arguments and result payloads are those supported as top-level or leaf values by `FlutterJSONMessageCodec`. */ FLUTTER_EXPORT @@ -318,9 +353,9 @@ FLUTTER_EXPORT /** A `FlutterMethodCodec` using the Flutter standard binary encoding. - The standard codec is guaranteed to be compatible with the corresponding - standard codec for PlatformMethodChannels on the Flutter side. These parts of - the Flutter SDK are evolved synchronously. + This codec is guaranteed to be compatible with the corresponding + [StandardMethodCodec](https://docs.flutter.io/flutter/services/StandardMethodCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. Values supported as method arguments and result payloads are those supported by `FlutterStandardMessageCodec`.