mapTypeRef method

String mapTypeRef(
  1. GqlTypeRef ref
)

Maps a raw introspection GqlTypeRef (from GqlSchema) to a Dart type string, following the same conventions as mapType. Used by the diff/codegen paths that work on the introspection model directly.

Implementation

String mapTypeRef(GqlTypeRef ref) {
  switch (ref.kind) {
    case GqlTypeKind.nonNull:
      final inner = ref.ofType!;
      if (inner.kind == GqlTypeKind.list) {
        return 'List<${mapTypeRef(inner.ofType!)}>';
      }
      return _namedBaseRef(inner);
    case GqlTypeKind.list:
      return 'List<${mapTypeRef(ref.ofType!)}>';
    default:
      return '${_namedBaseRef(ref)}?';
  }
}