disconnect method

Future<ConnectionResponse> disconnect({
  1. Duration? timeout,
})
override

timeout: milliseconds to wait after closing the socket

Implementation

Future<ConnectionResponse> disconnect({Duration? timeout}) async {
  if (Platform.isAndroid || Platform.isIOS) {
    await bluetooth.disconnect();
    this.isConnected = false;
  }
  //  else if (Platform.isIOS) {
  // await fbdevice.disconnect();
  // this.isConnected = false;
  // }

  if (timeout != null) {
    await Future.delayed(timeout, () => null);
  }
  return ConnectionResponse.success;
}