LazyBridgeRegistry<K> class
A key → BridgedClass map whose entries may be stored as deferred
thunks rather than pre-built classes.
Step #3 of the import-optimization plan (substrate for the generator's lazy emission, plan step #17). operator [] resolves a thunk on first access and memoizes the built BridgedClass, so a heavy class body (its seven member maps and all adapter closures) is constructed at most once. containsKey / keys / length only consult the thunk keys, so probing for a name never forces a build.
Used both name-keyed (K = String, lexical lookup) and type-keyed
(K = Type, native-object resolution). Today every entry is a trivial
() => alreadyBuiltClass thunk (registration still hands over built
classes — behaviour unchanged); once the generator emits genuinely
deferred thunks, the heavy body is built only when the name/type is
first touched during interpretation.
Mirror of the same class in tom_d4rt environment.dart.
Public so the D4rtRunner-level registries (_bridgedDefLookupByType and
the pooled _PackageBridgeBundle.bridgedDefLookupByType) can be
thunk-backed too — the generator's lazy emission (import-optimization plan
step #17) stores a Type → thunk entry at registration time without
building the class.
- Inheritance
-
- Object
- MapBase<
K, BridgedClass> - LazyBridgeRegistry
Constructors
Properties
-
entries
→ Iterable<
MapEntry< K, BridgedClass> > -
The map entries of this Map.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether there is no key/value pair in the map.
no setterinherited
- isNotEmpty → bool
-
Whether there is at least one key/value pair in the map.
no setterinherited
-
keys
→ Iterable<
K> -
The keys of this Map.
no setteroverride
- length → int
-
The number of key/value pairs in the map.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
values
→ Iterable<
BridgedClass> -
The values of this Map.
no setterinherited
Methods
-
addAll(
Map< K, BridgedClass> other) → void -
Adds all key/value pairs of
otherto this map.inherited -
addEntries(
Iterable< MapEntry< newEntries) → voidK, BridgedClass> > -
Adds all key/value pairs of
newEntriesto this map.inherited -
addThunksFrom(
LazyBridgeRegistry< K> other) → void -
Copies every deferred thunk (and any already-built memo) from
otherinto this registry without building the unresolved thunks. Used to merge a pooled bundle's type lookup into a per-instance one (the lazy counterpart ofMap.addAll, which would force a build viaforEach). -
cast<
RK, RV> () → Map< RK, RV> -
Provides a view of this map as having
RKkeys andRVinstances, if necessary.inherited -
clear(
) → void -
Removes all entries from the map.
override
-
containsKey(
Object? key) → bool -
Whether this map contains the given
key.inherited -
containsValue(
Object? value) → bool -
Whether this map contains the given
value.inherited -
forEach(
void action(K key, BridgedClass value)) → void -
Applies
actionto each key/value pair of the map.inherited -
map<
K2, V2> (MapEntry< K2, V2> transform(K key, BridgedClass value)) → Map<K2, V2> -
Returns a new map where all entries of this map are transformed by
the given
convertfunction.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
putIfAbsent(
K key, BridgedClass ifAbsent()) → BridgedClass -
Look up the value of
key, or add a new entry if it isn't there.inherited -
putThunk(
K key, BridgedClass thunk()) → void -
Registers
keyas a deferredthunk. The BridgedClass is not built until operator [] is first called forkey; any previously memoized result is dropped so the new thunk wins. -
remove(
Object? key) → BridgedClass? -
Removes
keyand its associated value, if present, from the map.override -
removeWhere(
bool test(K key, BridgedClass value)) → void -
Removes all entries of this map that satisfy the given
test.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
update(
K key, BridgedClass update(BridgedClass value), {BridgedClass ifAbsent()?}) → BridgedClass -
Updates the value for the provided
key.inherited -
updateAll(
BridgedClass update(K key, BridgedClass value)) → void -
Updates all values.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
Object? key) → BridgedClass? -
The value for the given
key, ornullifkeyis not in the map.override -
operator []=(
K key, BridgedClass value) → void -
Associates the
keywith the givenvalue.override