Made the switchEnvironment field in ArcaneEnvironment private (_switchEnvironment)

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2025-04-29 13:34:05 +02:00
parent 83aaa3b446
commit 186e6531b2
+6 -5
View File
@@ -9,15 +9,16 @@ class ArcaneEnvironment extends InheritedWidget {
/// The current application environment. /// The current application environment.
final Environment environment; final Environment environment;
final ValueChanged<Environment> switchEnvironment; final ValueChanged<Environment> _switchEnvironment;
/// Creates an `ArcaneEnvironment` widget. /// Creates an `ArcaneEnvironment` widget.
const ArcaneEnvironment({ const ArcaneEnvironment({
required this.environment, required this.environment,
required Widget child, required Widget child,
required this.switchEnvironment, required void Function(Environment) switchEnvironment,
Key? key, Key? key,
}) : super(key: key, child: child); }) : _switchEnvironment = switchEnvironment,
super(key: key, child: child);
/// Retrieves the `ArcaneEnvironment` instance from the nearest ancestor. /// Retrieves the `ArcaneEnvironment` instance from the nearest ancestor.
/// ///
@@ -42,8 +43,8 @@ class ArcaneEnvironment extends InheritedWidget {
return environment != oldWidget.environment; return environment != oldWidget.environment;
} }
void enableDebugMode() => switchEnvironment(Environment.debug); void enableDebugMode() => _switchEnvironment(Environment.debug);
void disableDebugMode() => switchEnvironment(Environment.normal); void disableDebugMode() => _switchEnvironment(Environment.normal);
} }
/// A `StatefulWidget` that manages and provides the `ArcaneEnvironment`. /// A `StatefulWidget` that manages and provides the `ArcaneEnvironment`.