6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 92bc9a6b

AuthorMikkel Thygesen<mikkelet@gmail.com>
Date2026-02-11 01:40:14 +0100
3616: lint

Changed files

.../onboarding/bluetooth/bluetooth_permission_cubit.dart  | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Diff

diff --git a/comwell_key_app/lib/presentation/screens/onboarding/bluetooth/bluetooth_permission_cubit.dart b/comwell_key_app/lib/presentation/screens/onboarding/bluetooth/bluetooth_permission_cubit.dart
index dbd8b434..e4e767b3 100644
--- a/comwell_key_app/lib/presentation/screens/onboarding/bluetooth/bluetooth_permission_cubit.dart
+++ b/comwell_key_app/lib/presentation/screens/onboarding/bluetooth/bluetooth_permission_cubit.dart
@@ -1,14 +1,14 @@
import 'dart:async';
import 'package:app_settings/app_settings.dart';
-import 'package:bloc/bloc.dart';
+import 'package:comwell_key_app/base/base_cubit.dart';
import 'package:comwell_key_app/domain/repositories/bluetooth_repository.dart';
import 'package:comwell_key_app/utils/secure_storage.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part "../../../../.generated/presentation/screens/onboarding/bluetooth/bluetooth_permission_cubit.freezed.dart";
-class BluetoothPermissionCubit extends Cubit<BluetoothPermissionState> {
+class BluetoothPermissionCubit extends BaseCubit<BluetoothPermissionState> {
BluetoothPermissionCubit(this._bluetoothRepository, this._preferences) : super(const BluetoothPermissionState()) {
init();
}
@@ -21,23 +21,24 @@ class BluetoothPermissionCubit extends Cubit<BluetoothPermissionState> {
Future<void> init() async {
await _preferences.setOnboardingHasSeenBluetooth();
_bluetoothStatusStream = _bluetoothRepository.isEnabledStream().listen((isEnabled) {
- emit(state.copyWith(isEnabled: isEnabled));
+ safeEmit(state.copyWith(isEnabled: isEnabled));
});
try {
- emit(state.copyWith(isLoading: true));
+ safeEmit(state.copyWith(isLoading: true));
await checkBluetoothStatus();
} catch (e, st) {
- emit(state.copyWith(errorType: ErrorType.error));
+ logError(e, st);
+ safeEmit(state.copyWith(errorType: ErrorType.error));
} finally {
- emit(state.copyWith(isLoading: false));
+ safeEmit(state.copyWith(isLoading: false));
}
}
Future<void> checkBluetoothStatus() async {
final isSupported = await _bluetoothRepository.isSupported();
if (!isSupported) return;
- emit(state.copyWith(isSupported: true));
+ safeEmit(state.copyWith(isSupported: true));
final isEnabled = await _bluetoothRepository.isEnabled();
if (!isEnabled) return;
}