TypeMapper class
Maps GraphQL types to Dart types for code generation.
Handles custom scalars, enums, and configured type overrides
from .zfa.json.
Spec 037 additions:
DateTimebuilt-in scalar →DateTime(FR-005).zfa.jsongraphql.scalarMapwiring via fromZfaConfig (FR-006)- mapTypeRef for raw introspection type references (diff-side)
- unionRepresentation / interfaceRepresentation Dart renderings (FR-008)
Constructors
-
TypeMapper({Map<
String, String> ? customScalars, Map<String, String> ? typeOverrides}) -
TypeMapper.fromZfaConfig(Map<
String, dynamic> zfaJson) -
Builds a mapper from a parsed
.zfa.jsondocument, readinggraphql.scalarMap(GraphQL scalar name → Dart type name).factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
interfaceRepresentation(
GraphQLInterfaceType type) → String -
Renders a Dart
abstract classfor a GraphQL interface type: declared fields become abstract final fields with mapped Dart types (FR-008). -
mapType(
GraphQLType type) → String - Map a GraphQLType to its Dart equivalent.
-
mapTypeRef(
GqlTypeRef ref) → String -
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. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
unionRepresentation(
GraphQLUnionType type) → String -
Renders a Dart
sealed classhierarchy for a GraphQL union type: every member type gets a typed variant class so all members remain accessible with their concrete types (FR-008).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
className(
String graphQLName) → String - Map a GraphQL type name to a Dart class name (PascalCase, reserved built-in type collisions escaped — spec 037 FR-007).
-
enumValue(
String graphQLValue) → String - Map a GraphQL enum value to a Dart enum value (camelCase).
-
fieldName(
String graphQLName) → String - Map a GraphQL field name to a Dart field name (camelCase, reserved words escaped — spec 037 FR-007).