isModelClass function

bool isModelClass(
  1. DartType? t
)

Determines if a type supports package:angel_serialize.

Implementation

bool isModelClass(DartType? t) {
  if (t == null) return false;

  if (serializableTypeChecker.hasAnnotationOf(t.element!)) {
    return true;
  }

  if (generatedSerializableTypeChecker.hasAnnotationOf(t.element!)) {
    return true;
  }

  if (const TypeChecker.fromRuntime(Model).isAssignableFromType(t)) {
    return true;
  }

  if (t is InterfaceType) {
    return isModelClass(t.superclass);
  } else {
    return false;
  }
}