withContext method

void withContext(
  1. BuildContext context
)

Provide the context to this highligher. This method will be used to update the brighness based on context in RichEditableText

If you're not using CreamyField or RichEditableText then use this to obtain context as it's required to get context.

Implementation

void withContext(BuildContext context) {
  // change brightness
  switch (themeMode) {
    case ThemeMode.light:
      _brightness = Brightness.light;
      break;
    case ThemeMode.dark:
      _brightness = Brightness.dark;
      break;
    case ThemeMode.system:
    default:
      _brightness = Theme.of(context).brightness;
      break;
  }
}