[UNTESTED] Fixes notifiers and adds some additional methods. Adds tests.

Changes:
// ArcaneEnvironment
breaking: context.read<ArcaneEnvironment>() -> ArcaneEnvironment.of(context)
breaking: context.read<ArcaneEnvironment>().state -> ArcaneEnvironment.of(context).environment;

// Feature flag service
added: reset()

// Logging service
added: registerInterface()
added: unregisterInterfaces()
added: unregisterAllInterfaces()

// ArcaneReactiveTheme
fixed: currentMode, dark, light now actually emit new values when changed
added: getters for lightTheme, darkTheme, and systemTheme
TODO: test systemTheme

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2025-04-04 17:08:06 +02:00
parent b129639f1f
commit ac82e93b9d
16 changed files with 1233 additions and 89 deletions
+4 -6
View File
@@ -53,14 +53,12 @@ class ArcaneServiceProvider extends InheritedNotifier {
/// final provider = ArcaneServiceProvider.of(context);
/// ```
static ArcaneServiceProvider of(BuildContext context) {
final ArcaneServiceProvider? result =
context.dependOnInheritedWidgetOfExactType<ArcaneServiceProvider>();
if (result == null) {
try {
return context
.dependOnInheritedWidgetOfExactType<ArcaneServiceProvider>()!;
} catch (e) {
throw Exception("ArcaneServiceProvider not found in context");
}
return result;
}
}