submitFaceVerify method

Future<SubmitResponse> submitFaceVerify(
  1. dynamic image,
  2. dynamic matchPercentage
)

livness complete submit/faceVerify token retun

Implementation

/// submit/faceVerify  token retun
Future<SubmitResponse> submitFaceVerify(image, matchPercentage) async {
  // print('submitFaceVerify image = $image');
  // List<int> bytes = await image.readAsBytes();
  // String base64File = base64Encode(bytes);
 // print(" //// submit/faceVerify ///");
  final dio = apiClient();
  Response response;
  var payload={
      "faceImage": image,
      "faceMatchPercent": matchPercentage,
      "dataSource": ""
  };
  try {
    var data = dio.then((value) async {
      response = await value.post("submit/faceVerify", data: payload);
      // print('submitFaceVerify = $response');
      if (response.statusCode == 200) {
        SubmitResponse results = SubmitResponse.fromMap(response.data);
        if(results.isSuccess){
          accessToken= results.token;
          return results;
        }else{
          throw Exception("Documents uploading failed");
        }
      } else {
        throw Exception(" uploading failed");
      }

    }).catchError((e) {
      //  print('eeeeeeee=${e.toString()}');
      throw Exception(e);
    });
    return data;
  }on DioError catch (_, e) {
    // print('e=${e.toString()}');
    throw Exception(e);
  }
}