readNamedTag static method

Tag readNamedTag(
  1. ByteLayer data, {
  2. int depth = -1,
})

Implementation

static Tag readNamedTag(ByteLayer data, {int depth = -1}) {
  var type = data.readByte();
  if (type == 0) {
    return EndTag();
  } else {
    Tag tag = makeTagOfType(TagType.get(type));
    tag._key = data.readString();
    tag.readValue(data, depth: depth);

    if (depth == 0) {
      data.disposeStream();
    }
    return tag;
  }
}