Packer class
Streaming API for packing (serializing) data to msgpack binary format.
Packer provide API for manually packing your data item by item in serial / streaming manner.
Use methods packXXX, where XXX is type names. Methods can take value and null
.
If null
provided for packXXX method it will be packed to null
implicitly.
For explicitly packing null
separate packNull function exist.
Streaming packing requires buffer to collect your data. Try to figure out the best initial size of this buffer, that minimal enough to fit your most common data packing scenario. Try to find balance. Provide this value in constructor Packer()
Constructors
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
packBinary(
List< int> ? buffer) → void -
Pack
List<int>
or null. -
packBool(
bool? v) → void -
Pack bool or
null
. -
packDouble(
double? v) → void -
Pack double or
null
. -
packInt(
int? v) → void -
Pack int or
null
. -
packListLength(
int? length) → void -
Pack List.length or
null
. -
packMapLength(
int? length) → void -
Pack Map.length or
null
. -
packNull(
) → void - Explicitly pack null value. Other packXXX implicitly handle null values.
-
packString(
String? v) → void -
Pack String or
null
. -
packStringEmptyIsNull(
String? v) → void -
Convenient function that call packString(v) by passing empty String as
null
. -
takeBytes(
) → Uint8List - Get bytes representation of this packer. Note: after this call do not reuse packer - create new.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited