decodeStream<T> method

Stream<T> decodeStream<T>({
  1. Decodable<T>? using,
})

Decodes a Stream of T using the provided Decodable.

Implementation

Stream<T> decodeStream<T>({Decodable<T>? using}) {
  final next = whatsNext();
  if (next is DecodingType<Stream>) {
    return decodeObject<Stream<T>>(using: AsyncDecodable._stream<T>(using));
  } else if (next case DecodingType.iterated || DecodingType.list) {
    return Stream<T>.fromIterable(decodeList<T>(using: using));
  } else {
    return Stream<T>.value(decodeObject<T>(using: using));
  }
}