diff --git a/lib/features/common/packages/bluetooth/blueberry_ring/domain/blueberry_ring_use_case.dart b/lib/features/common/packages/bluetooth/blueberry_ring/domain/blueberry_ring_use_case.dart index 250f933c..49cb2571 100644 --- a/lib/features/common/packages/bluetooth/blueberry_ring/domain/blueberry_ring_use_case.dart +++ b/lib/features/common/packages/bluetooth/blueberry_ring/domain/blueberry_ring_use_case.dart @@ -166,7 +166,7 @@ class BlueberryRingUseCase extends ReactiveUseCase { final command = BlueberryCommands.readLevel(); collectLog('readLevel:command $command'); blueberryRingCharacteristic.value?.write(command); - final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first; + final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty); collectLog('readLevel:value $value'); collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}'); return BlueberryResolves.readLevel(Uint8List.fromList(value!)); @@ -180,7 +180,7 @@ class BlueberryRingUseCase extends ReactiveUseCase { final command = BlueberryCommands.readVersion(); collectLog('readVersion:command $command'); blueberryRingCharacteristic.value?.write(command); - final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first; + final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty); collectLog('readVersion:value $value'); collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}'); return BlueberryResolves.readVersion(Uint8List.fromList(value!)); @@ -194,7 +194,7 @@ class BlueberryRingUseCase extends ReactiveUseCase { final command = BlueberryCommands.readTime(); collectLog('readTime:command $command'); blueberryRingCharacteristic.value?.write(command); - final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first; + final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty); collectLog('readTime:value $value'); collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}'); return BlueberryResolves.readTime(Uint8List.fromList(value!)); @@ -208,7 +208,7 @@ class BlueberryRingUseCase extends ReactiveUseCase { final command = BlueberryCommands.readSleep(); collectLog('readSleep:command $command'); blueberryRingCharacteristic.value?.write(command); - final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first; + final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty); collectLog('readSleep:value $value'); collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}'); return BlueberryResolves.readSleep(Uint8List.fromList(value!)); @@ -222,7 +222,7 @@ class BlueberryRingUseCase extends ReactiveUseCase { final command = BlueberryCommands.readBloodOxygens(); collectLog('readBloodOxygens:command $command'); blueberryRingCharacteristic.value?.write(command); - final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first; + final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty); collectLog('readBloodOxygens:value $value'); collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}'); return BlueberryResolves.readBloodOxygens(Uint8List.fromList(value!)); @@ -236,7 +236,7 @@ class BlueberryRingUseCase extends ReactiveUseCase { final command = BlueberryCommands.readSteps(); collectLog('readSteps:command $command'); blueberryRingCharacteristic.value?.write(command); - final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first; + final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty); collectLog('readSteps:value $value'); collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}'); return BlueberryResolves.readSteps(Uint8List.fromList(value!)); @@ -250,7 +250,7 @@ class BlueberryRingUseCase extends ReactiveUseCase { final command = BlueberryCommands.readHeartRates(); collectLog('readHeartRate:command $command'); blueberryRingCharacteristic.value?.write(command); - final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.first; + final value = await blueberryRingNotificationsCharacteristic.value?.lastValueStream.firstWhere((element) => element.isNotEmpty); collectLog('readHeartRate:value $value'); collectLog('readLevel:lastValue ${blueberryRingNotificationsCharacteristic.value!.lastValue}'); return BlueberryResolves.readHeartRates(Uint8List.fromList(value!));