isOpen property

Future<bool> isOpen

判断是否正在保持连接

返回值 "status" : 1: 已连接; 0: 未连接; -1: 未能查询, "info" 提供错误信息描述。

Implementation

Future<bool> get isOpen async {
  final Map? info = await _methodChannel.invokeMethod('isOpen');
  // info: Map<String, String>
  //   Keys: status(-1/0/1), info?
  if (info!['status'] == "1") {
    return true;
  }
  return false;
}