setConnectionState method
Sets the simulated connection state for a given BLE device.
This method allows tests to control the connection state of a device directly, without waiting for asynchronous connection streams to emit values. It is useful for simulating connection and disconnection events in tests that depend on the device's current state.
Implementation
void setConnectionState(String deviceAddress, BleConnectionState state) {
_connectionStates[deviceAddress] = state;
_connectionControllers[deviceAddress]?.add(state);
}