| 1234567891011121314151617181920212223242526272829303132 |
- /// Bluetooth adapter power state reported by the native bridge.
- ///
- /// `turningOn` and `turningOff` are deliberately separate from `on`/`off` so
- /// the Settings card never lists bonded devices while the stack is still
- /// initializing.
- enum BluetoothPowerState {
- unknown,
- unavailable,
- off,
- turningOn,
- on,
- turningOff;
- static BluetoothPowerState fromWire(Object? value) {
- return switch (value) {
- 'on' => on,
- 'off' => off,
- 'turning_on' => turningOn,
- 'turning_off' => turningOff,
- 'unavailable' => unavailable,
- _ => unknown,
- };
- }
- bool get isOn => this == BluetoothPowerState.on;
- bool get isOff => this == BluetoothPowerState.off;
- bool get isTransitioning =>
- this == BluetoothPowerState.turningOn ||
- this == BluetoothPowerState.turningOff;
- }
|