configureDarkModeAutoApply function
Configure auto-application of dark mode class.
Call this during app initialization with a function that adds/removes the 'dark' class on the document element.
// In web/main.dart
import 'dart:html';
void main() {
configureDarkModeAutoApply((isDark) {
document.documentElement!.classes.toggle('dark', isDark);
});
runApp(App());
}
Implementation
void configureDarkModeAutoApply(void Function(bool isDark) apply) {
_applyDarkModeClass = apply;
}