delete<T> method

  1. @override
Future<T?> delete<T>(
  1. String? correlationId,
  2. String key
)
override

Deletes a state from the store by its key.

  • correlationId (optional) transaction id to trace execution through call chain.
  • key a unique state key.

Implementation

@override
Future<T?> delete<T>(String? correlationId, String key) async {
  // Cleanup the stored states
  _cleanup();

  // Get the entry
  var entry = _states.containsKey(key) ? _states[key] : null;

  // Remove entry from the cache
  if (entry != null) {
    _states.remove(key);
    return entry.getValue();
  }

  return null;
}