read<V> method

  1. @override
V? read<V>(
  1. dynamic attribute
)
override

Returns the current value for a related attribute, if available.

Implementation

@override
V? read<V>(dynamic attribute) {
  if (attribute is DraftModeFieldDefinition<dynamic>) {
    return read<V>(attributeForUntyped(attribute));
  }
  if (attribute is! DraftModeFormAttribute) {
    return attribute as V?;
  }

  final key = identityHashCode(attribute);
  registerDependency(attribute);
  if (_drafts.containsKey(key)) {
    return _drafts[key] as V?;
  }
  return attribute.value as V?;
}