load<T> method

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

Loads stored value from the store using its key. If value is missing in the store it returns null.

  • correlationId (optional) transaction id to trace execution through call chain.
  • key a unique state key. Returns the state value or null if value wasn't found.

Implementation

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

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

  // Store has nothing
  if (entry == null) {
    return null;
  }

  return entry.getValue();
}