decodeFuture<T> method

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

Decodes a Future of T using the provided Decodable.

Implementation

Future<T> decodeFuture<T>(String key, {int? id, Decodable<T>? using}) {
  final next = whatsNext(key, id: id);
  if (next is DecodingType<Future> || next is DecodingType<Stream>) {
    return decodeObject<Future<T>>(key, id: id, using: AsyncDecodable._future<T>(using));
  } else {
    return Future.value(decodeObject<T>(key, id: id, using: using));
  }
}