resolve method

  1. @override
Color resolve(
  1. BuildContext context
)
override

Resolves the color value based on the current BuildContext.

If the color value is not defined in the theme, an assertion error is thrown. If the color value is a ColorResolver, it is resolved dynamically using the BuildContext. If the color value is null, Colors.transparent is returned.

Implementation

@override
Color resolve(BuildContext context) {
  final themeValue = MixTheme.of(context).colors[this];
  assert(
    themeValue != null,
    'ColorToken $name is not defined in the theme',
  );

  return themeValue is ColorResolver
      ? themeValue.resolve(context)
      : themeValue ?? Colors.transparent;
}