FontKey class abstract


FontKey (sealed class)

Represents a type-safe key for font families in the design system.

Purpose:

  • Provides predefined font keys (primary, secondary) for common usage.
  • Allows runtime custom font keys using FontKey.custom('myFont').
  • Ensures type safety and reduces errors compared to raw strings.
  • Works seamlessly with FontRegistry and FontHelper.

Usage:

// Predefined fonts
final primaryKey = FontKey.primary;
final secondaryKey = FontKey.secondary;

// Custom font key
final customKey = FontKey.custom('brandX');

Constructors

FontKey.custom(String key)
Custom font key for runtime fonts
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
key String
Internal string representation of the key
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

primary → const _PredefinedKey
Predefined primary font
secondary → const _PredefinedKey
Predefined secondary font