getTagsFromByteArray method

Future<List<Tag>> getTagsFromByteArray(
  1. Future<List<int>>? bytes, [
  2. List<TagType>? types
])

Returns the tags from the byte array

Implementation

Future<List<Tag>> getTagsFromByteArray(Future<List<int>>? bytes,
    [List<TagType>? types]) async {
  if (await bytes == null) {
    throw ParsingException(ParsingException.byteArrayNull);
  }

  final tags = <Tag>[];

  if (types == null || types.isEmpty) {
    types = _readers.keys.toList();
  }

  for (var t in types) {
    tags.add(await _readers[t]!.read(bytes!.then((value) => value)));
  }

  return tags;
}