StandardMessageCodec class
MessageCodec using the Flutter standard binary encoding.
Supported messages are acyclic values of these forms:
- null
- bools
- nums
- Strings
- Uint8Lists, Int32Lists, Int64Lists, Float64Lists
- Lists of supported values
- Maps from supported values to supported values
Decoded values will use List<dynamic> and Map<dynamic, dynamic>
irrespective of content.
On Android, messages are represented as follows:
- null: null
- bool:
java.lang.Boolean - int:
java.lang.Integerfor values that are representable using 32-bit two's complement;java.lang.Longotherwise - double:
java.lang.Double - String:
java.lang.String - Uint8List:
byte[] - Int32List:
int[] - Int64List:
long[] - Float64List:
double[] - List:
java.util.ArrayList - Map:
java.util.HashMap
On iOS, messages are represented as follows:
- null: nil
- bool:
NSNumber numberWithBool: - int:
NSNumber numberWithInt:for values that are representable using 32-bit two's complement;NSNumber numberWithLong:otherwise - double:
NSNumber numberWithDouble: - String:
NSString - Uint8List, Int32List, Int64List, Float64List:
FlutterStandardTypedData - List:
NSArray - Map:
NSDictionary
The codec is extensible by subclasses overriding writeValue and readValueOfType.
- Implemented types
Constructors
- StandardMessageCodec()
-
Creates a MessageCodec using the Flutter standard binary encoding.
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
messagefrom binary. [...]override -
encodeMessage(
dynamic message) → ByteData -
Encodes the specified
messagein binary. [...]override -
readSize(
ReadBuffer buffer) → int -
Reads a non-negative int from
bufferas written by writeSize. [...] -
readValue(
ReadBuffer buffer) → dynamic -
Reads a value from
bufferas written by writeValue. [...] -
readValueOfType(
int type, ReadBuffer buffer) → dynamic -
Reads a value of the indicated
typefrombuffer. [...] -
writeSize(
WriteBuffer buffer, int value) → void -
Writes a non-negative 32-bit integer
valuetobufferusing an expanding 1-5 byte encoding that optimizes for small values. [...] -
writeValue(
WriteBuffer buffer, dynamic value) → void -
Writes
valuetobufferby first writing a type discriminator byte, then the value itself. [...] -
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