isConnected method

Future<bool> isConnected({
  1. bool debug = false,
})

Checks if the device is connected.

Returns true if the device is connected, false otherwise.

Implementation

Future<bool> isConnected({bool debug = false}) async {
  final result = await _bridge.executor.execute(
    [..._connection.arguments, 'get-state'],
    checkIfRunning: false,
    debug: debug,
  );
  if (result.exitCode != 0) {
    return false;
  }
  return result.stdout.toString().contains('device');
}