Accessor class abstract
Base class for all generated schema types.
A generated type is a thin, allocation-cheap view over a location in the
cache: (selection node, cache path). Every getter records the field on
the selection tree, then reads the value at path + field from the cache.
Typed getters are generated from the schema, so there is no dynamic
dispatch and everything is tree-shakeable — this is what replaces JS
Proxy in GQty.
Properties
- $typename → String?
-
The
__typenameof the cached object, if any.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isSkeleton → bool
-
True when this object does not exist in cache yet (skeleton state):
every scalar read returns
nulland records a miss.no setter -
path
→ List<
Object> -
This object's location in the cache: aliases and list indices, walked
from the operation root — or from an entity when the first element is a
Ref (see
lookupon object).final - recorder → Recorder
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selection → Selection
-
This object's node in the selection tree.
final
Methods
-
enumList<
T> (String field, T parse(String), {Map< String, Arg> ? args}) → List<T?> ? -
Reads a list of enums, mapping each wire
Stringthroughparse. Same miss/skeleton semantics as scalarList. -
enumValue<
T> (String field, T parse(String), {Map< String, Arg> ? args}) → T? -
Reads an enum field: the cached wire
Stringmapped throughparse(the generatedfromGraphQL). Same miss/skeleton semantics as scalar. -
isFetched(
String field, {Map< String, Arg> ? args}) → bool -
True when the cache holds a value for
fieldon this object — including an explicit servernull— false when it was never fetched. This is the per-field counterpart toQueryState.hasMissingData: use it to tell "not fetched yet" apart from "the server saidnull" for one field, without branching the whole widget on isSkeleton. -
list<
R extends Accessor> (String field, R ctor(Recorder, Selection, List< Object> ), {Map<String, Arg> ? args, bool keyed = false}) → List<R> ? -
Reads a list of objects. Skeleton lists contain a single skeleton element
so
list.map((e) => e.name)still records the element selection. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
object<
R extends Accessor> (String field, R ctor(Recorder, Selection, List< Object> ), {Map<String, Arg> ? args, bool keyed = false, String? lookup}) → R? -
Reads an object field. Returns a skeleton accessor when not cached,
nullonly when the server explicitly returnednull. -
on<
R extends Accessor> (String typename, R ctor(Recorder, Selection, List< Object> ), {bool keyed = false}) → R? -
Views this object as the concrete type
typename(the inline fragment... on Typename): fields read through the result are selected inside that fragment and read at this object's cache location. -
scalar<
T> (String field, {Map< String, Arg> ? args}) → T? -
Reads a scalar field. Returns
null(and records a miss) when not cached. -
scalarAs<
T, W> (String field, T parse(W), {Map< String, Arg> ? args}) → T? -
Reads a scalar field whose wire form (type
W, read via scalar — usuallyString) is converted to a richer Dart typeTbyparse. Backs both enumValue and a generator--scalarmapping (e.g.DateTime). Same miss/skeleton semantics as scalar. -
scalarList<
T> (String field, {Map< String, Arg> ? args}) → List<T?> ? -
Reads a list of scalars. Skeleton lists contain a single
null. -
scalarListAs<
T, W> (String field, T parse(W), {Map< String, Arg> ? args}) → List<T?> ? - Reads a list of such values (see scalarAs). Same miss/skeleton semantics as scalarList.
-
toString(
) → String -
A string representation of this object.
override
-
whenType<
T> (Map< String, T Function()> cases, {T orElse()?}) → T? -
Runs the branch of
casesfor this object's__typename,orElsefor a type without a branch (e.g. one added to the schema later),nullwhen neither applies. Backs the generatedwhen(...). -
write(
String field, Object? value) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited