disconnect method

  1. @override
Future<bool> disconnect({
  1. required Duration delay,
})
override

Disconnect from a Bluetooth device. Throw BTException if failed. delay is the time to wait before disconnecting.

Implementation

@override
Future<bool> disconnect({required Duration delay}) async {
  try {
    Map<String, dynamic> args = {"isBLE": _connectionIsLE, "delay": delay.inMilliseconds};
    return await methodChannel.invokeMethod("disconnect", args).onError((error, stackTrace) => null);
  } on PlatformException catch (e) {
    throw BTException.fromPlatform(e);
  }
}