disconnect method

  1. @override
Future<bool> disconnect(
  1. String address,
  2. int timeout
)
override

Implementation

@override
Future<bool> disconnect(String address, int timeout) async {
  try {
    final version = await methodChannel.invokeMethod(
        'disconnect', <String, dynamic>{'address': address}).timeout(
      Duration(seconds: timeout ?? 30), // กำหนด Timeout 5 นาที
      onTimeout: () {
        throw TimeoutException(
            "Method disconnect timed out after 5 minutes.");
      },
    );
    return version;
  } on TimeoutException catch (e) {
    return false;
  } catch (e) {
    return false;
  }
}