enterScanning method

dynamic enterScanning(
  1. dynamic callback(
    1. bool isSuccess,
    2. String msg
    )
)

Implementation

enterScanning(Function(bool isSuccess, String msg) callback) {
  wifiSetting(callback: (isSuccess) {
    getScannerInfo((isSuccess) {
      if (isSuccess) {
        if (Platform.isIOS) {
          //iOS需要手动停止监听网络连接情况
          MethodChannel methodChannel = const MethodChannel(messageChannelID);
          Map map = {
            'wifiName': '',
            'wifiPassword': '',
            'operation': 'stopReaching'
          };
          methodChannel.invokeListMethod("flutterCallNativeWifi", map);
        }
        if (model!.scan!) {
          startScan();
        } else {}
      } else {
        callback(false, '获取扫描仪数据失败,请重试');
      }
    });
  });
}