firstModelAncestor function

InterfaceType? firstModelAncestor(
  1. DartType? type
)

Implementation

InterfaceType? firstModelAncestor(DartType? type) {
  if (type is InterfaceType) {
    if (type.superclass != null &&
        const TypeChecker.fromRuntime(Model).isExactlyType(type.superclass!)) {
      return type;
    } else {
      return type.superclass == null
          ? null
          : firstModelAncestor(type.superclass);
    }
  } else {
    return null;
  }
}