attributeFor<T> method

DraftModeFormAttribute<T> attributeFor<T>(
  1. DraftModeFieldDefinition<T> definition
)

Implementation

DraftModeFormAttribute<T> attributeFor<T>(
  DraftModeFieldDefinition<T> definition,
) {
  final key = identityHashCode(definition);
  final existing = _definitionAttributes[key];
  if (existing != null) {
    if (existing is DraftModeFormAttribute<T>) {
      return existing;
    }
    return _promoteDefinitionAttribute<T>(definition, existing);
  }

  final attribute = DraftModeFormAttribute.fromDefinition(definition);
  registerAttribute(attribute);
  return attribute;
}