JSONMessageCodec class

MessageCodec with UTF-8 encoded JSON messages.

Supported messages are acyclic values of these forms:

  • null
  • bools
  • nums
  • Strings
  • Lists of supported values
  • Maps from strings to supported values

On Android, messages are decoded using the org.json library. On iOS, messages are decoded using the NSJSONSerialization library. In both cases, the use of top-level simple messages (null, bool, num, and String) is supported (by the Flutter SDK). The decoded value will be null/nil for null, and identical to what would result from decoding a singleton JSON array with a Boolean, number, or string value, and then extracting its single element.

Implements

Constructors

JSONMessageCodec()
Creates a MessageCodec with UTF-8 encoded JSON messages.
const

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

decodeMessage(ByteData message) → dynamic
Decodes the specified message from binary. [...]
encodeMessage(dynamic message) ByteData
Encodes the specified message in binary. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited