getValue<T> method

T? getValue<T>(
  1. FormKey<T> key
)

Retrieves a typed value for a specific form key.

Parameters:

  • key (FormKey<T>, required): The form key to look up.

Returns: T? — the value if found and correctly typed, null otherwise.

Implementation

T? getValue<T>(FormKey<T> key) {
  Object? value = this[key];
  if (value == null) {
    return null;
  }
  assert(key.isInstanceOf(value),
      'The value for key $key is not of type ${key.type}');
  return value as T?;
}