SharedMap<K, V> class abstract

Base class for SharedMap implementations.

Inheritance
Implementers

Constructors

SharedMap.fromSharedReference(SharedMapReference sharedReference)
Creates a SharedMap from sharedReference.
factory
SharedMap.notShared()
Creates a SharedMap that can NOT be shared. Useful for tests or to have a version that disables the share capabilities.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
The ID of the referenceable instance.
no setterinherited
onAbsent SharedMapKeyCallback<K, V>?
Optional callback for when an entry is accessed and is absent.
getter/setter pair
onInitialize SharedMapEventCallback?
Optional callback for when the SharedMap instance is initialized.
getter/setter pair
onPut SharedMapEntryCallback<K, V>?
Optional callback for when put is called.
getter/setter pair
onRemove SharedMapEntryCallback<K, V>?
Optional callback for when remove is called.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sharedStore SharedStore
The SharedStore where this instance is stored/handled.
no setter

Methods

cached({Duration? timeout}) SharedMapCached<K, V>
Returns a cached version of this instance.
clear() FutureOr<int>
Clears all the entries and returns the amount of removed entries.
entries() FutureOr<List<MapEntry<K, V>>>
Returns all the entries.
get(K key) FutureOr<V?>
Returns the value of key.
keys() FutureOr<List<K>>
Returns all the keys.
length() FutureOr<int>
Returns keys length.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(K key, V? value) FutureOr<V?>
Sets the value of key and returns it.
putIfAbsent(K key, V? absentValue) FutureOr<V?>
Sets the absentValue of key if it's null, and returns it. If the key value is already define and is NOT null, returns the previous value.
remove(K key) FutureOr<V?>
Remove the key entry and return the removed value.
removeAll(List<K> keys) FutureOr<List<V?>>
Remove the keys entries and return the removed values.
setCallbacks({SharedMapEventCallback? onInitialize, SharedMapKeyCallback<K, V>? onAbsent, SharedMapEntryCallback<K, V>? onPut, SharedMapEntryCallback<K, V>? onRemove}) → void
setCallbacksDynamic<K1, V1>({SharedMapEventCallback? onInitialize, SharedMapKeyCallback<K1, V1>? onAbsent, SharedMapEntryCallback<K1, V1>? onPut, SharedMapEntryCallback<K1, V1>? onRemove}) → void
sharedReference() SharedMapReference
Returns the SharedReference of this instances, to instantiate it using a fromSharedReference constructor.
override
toString() String
A string representation of this object.
inherited
update(K key, SharedMapUpdater<K, V> updater) FutureOr<V?>
Updated the key value by running the updater code in the same memory context (Isolate) as the main instance.
values() FutureOr<List<V>>
Returns all the values.
where(bool test(K key, V value)) FutureOr<List<MapEntry<K, V>>>
Returns all the entries that satisfy the predicate test.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

from<K, V>({SharedMapReference? reference, String? id, SharedStoreReference? sharedStoreReference, SharedStore? sharedStore, String? sharedStoreID, SharedMapEventCallback? onInitialize, SharedMapKeyCallback<K, V>? onAbsent, SharedMapEntryCallback<K, V>? onPut, SharedMapEntryCallback<K, V>? onRemove}) FutureOr<SharedMap<K, V>>
Creates a SharedMap from reference or id.
fromID<K, V>(SharedStore sharedStore, String id, {SharedMapEventCallback? onInitialize, SharedMapKeyCallback<K, V>? onAbsent, SharedMapEntryCallback<K, V>? onPut, SharedMapEntryCallback<K, V>? onRemove}) FutureOr<SharedMap<K, V>>
Creates a SharedMap with id.
fromUUID<K, V>(SharedStore sharedStore) FutureOr<SharedMap<K, V>>
Creates a SharedMap using a ReferenceableType.newUUID as id.