update<T extends Object> method
Updates the specified global shared object.
update -- Callback event for updating shared data.
mark
--
The unique identifier of the shared object to be registered.
If there is only one shared object of the same type in the project,
it can be used to distinguish it. Otherwise, it needs to be used to distinguish it.
Implementation
void update<T extends Object>(
T? Function(T? value) update, {
String? mark,
}) {
final String key = keyGet<T>(mark);
final T? _instance = instanceGet(_recordPool, key);
final T? item = update.call(_instance);
if (_instance == null) {
_recordPool.putIfAbsent(key, () => item);
} else {
_recordPool.update(key, (value) => item);
}
}