typeOfFuture<_SiblingModel extends Model> static method
DartType?
typeOfFuture<_SiblingModel extends Model>(
- DartType type
Destructs a type to determine the bottom type after going through Futures and Iterables.
For example, int in Future<int> or List<String> in Future<List<String>>.
Futures of Future iterables (e.g. Future<List<Future<String>>>) are not supported,
however, Futures in Iterables are supported (e.g. List<Future<String>>).
Implementation
static DartType? typeOfFuture<_SiblingModel extends Model>(DartType type) {
final checker = SharedChecker<_SiblingModel>(type);
// Future<?>
if (checker.isFuture) {
return checker.argType;
} else {
// Iterable<Future<?>>
if (checker.isIterable) {
final iterableChecker = SharedChecker<_SiblingModel>(checker.argType);
// Future<?>
if (iterableChecker.isFuture) {
return iterableChecker.argType;
}
}
}
return null;
}