load method

dynamic load(
  1. ByteBuf buffer
)

Deserializes the serialized binary contents of the buffer recursively using the registered Picklers and returns the decoded value

Implementation

dynamic load(ByteBuf buffer) {
  var idPicklePickler =
      picklers[IdentifiedPicklePickler.ID] as Pickler<IdentifiedPickle>;
  var idPickle = idPicklePickler.unpickle(buffer);
  var pickler = picklers[idPickle.pickler]!;
  var data = pickler.unpickle(idPickle.data);
  if (data is DataListPickle) return data.data.map((e) => load(e)).toList();
  if (data is DataSetPickle) {
    return data.data.map((e) => load(e)).toList().toSet();
  }
  if (data is DataMapPickle) {
    var map = {};
    for (var element in data.data.entries) {
      map[load(element.key)] = load(element.value);
    }
    return map;
  }
  return data;
}