disconnect method

  1. @nonVirtual
Future<bool> disconnect()

Ask this DeviceManager to disconnect from the device.

Returns true if successful, false if not.

Implementation

@nonVirtual
Future<bool> disconnect() async {
  bool success = false;
  if (status != DeviceStatus.connected) {
    warning(
        '$runtimeType is not connected, so nothing to disconnect from....');
    return true;
  }

  info(
      '$runtimeType - Trying to disconnect to device of type: $type and id: $id');
  success = await onDisconnect();
  status = (success) ? DeviceStatus.disconnected : DeviceStatus.error;

  return success;
}