isSubtype<TChild, TParent> function

bool isSubtype<TChild, TParent>()

Returns true if A is a subtype of B.

print(isSubtype<int, num>()); // true, int is a num
print(isSubtype<num, int>()); // false, num is not an int
print(isSubtype<Future<int>, Future<dynamic>>()); // true, Future<int> is a Future<dynamic>
print(isSubtype<Future<dynamic>, Future<int>>()); // false, Future<dynamic> is not a Future<int>
print(isSubtype<int Function(int), Function>()); // true, int Function(int) is a Function
print(isSubtype<Function, int Function(int)>()); // false, Function is not a int Function(int)

Implementation

bool isSubtype<TChild, TParent>() => <TChild>[] is List<TParent>;