subscribe static method
Returns a StreamSubscription for DemoMode enabled value
Fires onEnabled
if the DemoMode is enabled
Fires onDisabled
if the DemoMode is disabled.
Implementation
static StreamSubscription<bool> subscribe({
required void Function()? onEnabled,
required void Function()? onDisabled,
}) {
final notify = (isEnabled) {
if (isEnabled) {
onEnabled?.call();
}
if (!isEnabled) {
onDisabled?.call();
}
};
notify(isEnabled);
return _onDemoModeChanged.stream.listen(notify);
}