requireCapability<T> function
Logoheadless

requireCapability<T>#

T requireCapability<T>( HeadlessTheme theme, { required String componentName, });

Require a capability from the theme, throwing a standardized error if missing.

This is the central guard for capability discovery. Components should use this instead of checking HeadlessTheme.capability directly when the capability is required.

Example:

final renderer = requireCapability<RButtonRenderer>(
  theme,
  componentName: 'RTextButton',
);

Throws MissingCapabilityException if the capability is not available.