internal library
Internals of sling_gql: the pieces the runtime, its tests and future
adapters (persistence, subscriptions) are built from, kept out of
package:sling_gql/sling_gql.dart so the app-facing surface stays small.
- NormalizedCache, Ref, missing, depKey (and elementDepKey,
lengthDepKey): the store's building
blocks. Apps use the Cache interface (
client.cache.snapshot,evict,onChange…) and never these. - CacheWrite, MutationScope, SubscriptionScope, RowScope,
ListLocator: the recorder machinery behind optimistic writes,
mutations, subscriptions,
SlingRowandCacheScope.list. - debugOwnerLabel: the default scope label of the widgets, for adapters
(
sling_gql_hooks).
No stability promise: anything here can change in a minor release.
Classes
- CacheWrite
-
Description of one manual write (
launch.favorite = true), enough to undo it: the previous value is missing when the path did not exist. - ListLocator
-
Implemented by recorders that need to know where each object list read
through them lives in the cache (
CacheScope.listuses it to edit the list its selector returned). Accessor.list reports every read: the list's cachepathand thevalueit returned to the caller. - MutationScope
-
Recorder for one
mutatecall. Misses are expected (nothing is cached before the mutation runs) and never trigger a fetch. - NormalizedCache
-
Entity-normalized store:
{ "ROOT_QUERY": {...}, "Launch:launch-181": {...} }. - Ref
- A reference to a normalized entity, stored in place of the object itself.
- RowScope
-
A sub-scope of a QueryScope for one part of its tree — typically one row
of a long list — that rebuilds on its own (
SlingRowis the widget form). - SubscriptionScope
- Recorder for one SlingClient.subscribeWith call. The body runs once to record the selection (misses are expected and never fetch); the same scope is then used to compute each event's value from the cache.
Constants
- missing → const _Missing
-
Sentinel returned by
Cache.readwhen a path does not exist.
Functions
-
debugOwnerLabel(
BuildContext context) → String? -
Debug-mode name for a sling widget's scope: the type of the nearest
enclosing app widget (
LaunchesScreen), found by walking up to the SlingScope past render/proxy widgets and sling's own.nullin release builds (type names are minified there), when the widget sits right under the SlingScope, or when there is none. -
depKey(
String entity, String field) → String -
Dependency key for
fieldon entityentity— the currency used to tell scopes what changed (ROOT_QUERY.launches_c0y93u18lig6v,Launch:launch-181.name). -
elementDepKey(
String entity, String field, int index) → String -
Dependency key for element
indexof the list held byfieldonentity(Launch:launch-181.links[2]): what a read through an inline element (not a Ref) records instead of depKey, so a change to one element rebuilds its readers only. Readers through a Ref element keep depKey. Lists nested deeper (in an element, in an inline object) are part of the element / field holding them. -
lengthDepKey(
String entity, String field) → String -
Dependency key for the length of the list held by
fieldonentity(Launch:launch-181.links[length]): whatAccessor.listof inline objects records instead of depKey — it builds one accessor per index and reads nothing else. Touched when the length changes or the list is replaced by something else.