useThemeSelector method

void useThemeSelector(
  1. BuildContext context, {
  2. T light(
    1. T
    )?,
  3. T dark(
    1. T
    )?,
})

Implementation

void useThemeSelector(
  BuildContext context, {
  T Function(T)? light,
  T Function(T)? dark,
}) {
  final isDark = Theme.of(context).brightness == Brightness.dark;

  if (isDark && dark != null)
    apply = dark(self);
  else if (!isDark && light != null) apply = light(self);
}