requiredValue<T> method
Returns the decoded value for key, throwing when it is missing.
Implementation
T requiredValue<T>(String key, {PayloadCodec<T>? codec}) {
if (!containsKey(key) || this[key] == null) {
throw StateError("Missing required payload key '$key'.");
}
return value<T>(key, codec: codec) as T;
}