liveOf static method

The per-frame theme as a listenable for painters (repaint:). Registers no dependency on the data itself.

Implementation

static ValueListenable<CalcThemeData> liveOf(BuildContext context) {
  final theme = InheritedModel.inheritFrom<CalcTheme>(
    context,
    aspect: CalcThemeAspect.live,
  );
  if (theme == null) {
    return FixedCalcTheme(
      PlainTheme.of(MediaQuery.maybePlatformBrightnessOf(context)),
    );
  }
  return theme.live ?? FixedCalcTheme(theme.data);
}