getSubclassesOf method Null safety

List<ClassMirror> getSubclassesOf(
  1. Type type
)

Implementation

List<ClassMirror> getSubclassesOf(Type type) {
  final mirror = reflectClass(type);
  return types.where((decl) {
    if (decl.isAbstract) {
      return false;
    }

    if (!decl.isSubclassOf(mirror)) {
      return false;
    }

    if (decl.hasReflectedType) {
      if (decl.reflectedType == type) {
        return false;
      }
    }

    return true;
  }).toList();
}