onEnabledChange static method
Subscribes to enabled state changes.
Implementation
static StreamSubscription<bool> onEnabledChange(
void Function(bool) callback, {
Function? onError,
}) {
return events
.where((event) => event.type == EventType.enabledChange)
.map((event) => event.data == true)
.listen(callback, onError: onError);
}