decodeStream<T> method

Stream<T> decodeStream<T>(
  1. String key, {
  2. int? id,
  3. Decodable<T>? using,
})

Decodes a Stream of T using the provided Decodable.

Implementation

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