checkFacedata static method

Future<CheckFace> checkFacedata(
  1. File image
)

Check Face Match in Server

Implementation

static Future<CheckFace> checkFacedata(File image) async {
  final storage = FlutterSecureStorage();
  String? signatureKey = await storage.read(key: 'signatureKey');
  String? token = await storage.read(key: 'token');
  String checkface = "${Services.productionUrl}/v1/ChromePayOCR/kacha/Check_Face_API";

  Map<String, String> requestHeaders = {
    'Authorization': "Bearer ${Services.token}",
    'Content-Type': 'application/json',
    'Signature': '$signatureKey',
    'Access-Control-Allow-Origin': '*',
    'origin': 'Od5GqEoVcqejFJw21G3zhZyuYNj5OOcSyTWLIRnagfIH'
  };

  var request = http.MultipartRequest("POST", Uri.parse(checkface));
  var multipart = await http.MultipartFile.fromPath("userImage", image.path);
  request.headers.addAll(requestHeaders);
  request.files.add(multipart);

  var response = await request.send();
  var responce = await http.Response.fromStream(response);
  // print("object URL :- ${checkface}");
  // print("object HEADER :- ${request.headers}");
  // print("object REQUEST :- ${request.files}");
  // print("object RESPONSE :- ${responce.body}");

  var data = jsonDecode(responce.body);
  return CheckFace.fromJson(data);
}