void _tryLoadNewModelClass()

in lib/src/db/model_db_impl.dart [228:254]


  void _tryLoadNewModelClass(mirrors.ClassMirror classMirror) {
    Kind? kindAnnotation;
    for (var instance in classMirror.metadata) {
      if (instance.reflectee.runtimeType == Kind) {
        if (kindAnnotation != null) {
          throw StateError(
              'Cannot have more than one ModelMetadata() annotation '
              'on a Model class');
        }
        kindAnnotation = instance.reflectee as Kind?;
      }
    }

    if (kindAnnotation != null) {
      var name = kindAnnotation.name;
      var integerId = kindAnnotation.idType == IdType.Integer;
      var stringId = kindAnnotation.idType == IdType.String;

      // Fall back to the class name.
      name ??= mirrors.MirrorSystem.getName(classMirror.simpleName);

      // This constraint should be guaranteed by the Kind() const constructor.
      assert((integerId && !stringId) || (!integerId && stringId));

      _tryLoadNewModelClassFull(classMirror, name, integerId);
    }
  }