mattinger
05/06/2022, 4:03 PMvar startBluetoothFlow by remember { mutableStateOf(false) }
LaunchedEffect(key1 = true) {
if (!host.bleManager.isReadyForScanning) {
startBluetoothFlow = true
}
}
if (startBluetoothFlow) {
BluetoothController(
permissionState = permissionState,
bluetooth = host.bleManager,
navHostController = navController,
)
}
The problem is that BluetoothController is getting evaluated multiple timesmattinger
05/06/2022, 4:15 PMFrancesc
05/06/2022, 4:27 PMtrue, it will remain true and trigger your if block at each composition.
You could wrap your if block in a LaunchedEffect with key startBluetothFlow or maybe just move this block into the existing LaunchedEffectmattinger
05/06/2022, 5:14 PM