MsgPackWriter class

Implements a msgpack serializer over the base BytesWriter.

To support serialization of custom objects it relies on the definition a function on the target object that provides a Map<String, dynamic> representation. Those methods can be automatically generated with the json_serializable dart package or similar. Per convention it is assumed that there is a toJson() method on the target object. Note that what is serialized is the Map representation of the object, therefore this transformation should be provided in some form.

Inheritance

Constructors

MsgPackWriter({Map<String, dynamic> toEncodable(dynamic)?, List<MsgPackExtension>? extensions})
Builds a MsgPackWriter serializer.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

encodeString(String s) List<int>
Encodes a String s with the configured Encoding
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
takeBytes() Uint8List
Takes the list of bytes from the buffer as a Uint8List
inherited
toString() String
A string representation of this object.
inherited
write(dynamic d) → void
Writes a dynamic value into the buffer
override
writeBinary(Uint8List buffer) → void
Writes a Uint8List into the buffer
override
writeBool(bool b) → void
Writes bool b into the buffer
override
writeByteData(ByteData buffer) → void
Writes a buffer of bytes
inherited
writeBytes(List<int> bytes) → void
Writes a list of bytes
inherited
writeDouble(double n) → void
Writes double n into the buffer
override
writeExt(int type, Uint8List bytes) → void
Writes the type extension to the buffer
writeFloat32(double f, [Endian endian = Endian.big]) → void
Writes a float32 f into the buffer
inherited
writeFloat64(double d, [Endian endian = Endian.big]) → void
Writes a float64 d into the buffer
inherited
writeInt(int n) → void
Writes int n into the buffer
override
writeInt16(int i, [Endian endian = Endian.big]) → void
Writes a int16 i in the buffer
inherited
writeInt32(int i, [Endian endian = Endian.big]) → void
Writes a int32 i into the buffer
inherited
writeInt64(int i, [Endian endian = Endian.big]) → void
Writes a int64 i into the buffer
inherited
writeInt8(int i) → void
Writes a int8 i into the buffer
inherited
writeIterable(Iterable iterable) → void
Writes a Iterable into the buffer
override
writeMap(Map map) → void
Writes a Map into the buffer
override
writeNull() → void
Writes null
override
writeString(String s) → void
Writes a String s into the buffer
override
writeUint16(int i, [Endian endian = Endian.big]) → void
Writes a uint16 i into the buffer
inherited
writeUint32(int i, [Endian endian = Endian.big]) → void
Writes a uint32 i into the buffer
inherited
writeUint64(int i, [Endian endian = Endian.big]) → void
Writes a uint64 i into the buffer
inherited
writeUint8(int i) → void
Writes a Uint8 i into the buffer
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited