fromJson static method

  1. @visibleForTesting
DetectFaceResult? fromJson(
  1. dynamic jsonObject
)

Implementation

@visibleForTesting
static DetectFaceResult? fromJson(jsonObject) {
  if (jsonObject == null) return null;
  var result = DetectFaceResult._privateConstructor();

  if (jsonObject["quality"] != null) {
    result._quality = [];
    for (var item in jsonObject["quality"]) {
      result._quality!.add(ImageQualityResult.fromJson(item)!);
    }
  }
  if (jsonObject["attributes"] != null) {
    result._attributes = [];
    for (var item in jsonObject["attributes"]) {
      result._attributes!.add(DetectFacesAttributeResult.fromJson(item)!);
    }
  }
  result._crop = _bytesFromBase64(jsonObject["crop"]);
  if (jsonObject["landmarks"] != null) {
    result._landmarks = [];
    for (var item in jsonObject["landmarks"]) {
      result._landmarks!.add(Point.fromJson(item)!);
    }
  }
  result._faceRect = Rect.fromJson(jsonObject["faceRect"]);
  result._originalRect = Rect.fromJson(jsonObject["originalRect"]);
  result._isQualityCompliant = jsonObject["isQualityCompliant"];

  return result;
}