fromJson static method

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

Implementation

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

  result._scenario = Scenario.getByValue(jsonObject["scenario"]);
  result._onlineProcessingConfig =
      OnlineProcessingConfig.fromJson(jsonObject["onlineProcessingConfig"]);
  result.livePortrait = _bytesFromBase64(jsonObject["livePortrait"]);
  result.extPortrait = _bytesFromBase64(jsonObject["extPortrait"]);
  result.oneShotIdentification = jsonObject["oneShotIdentification"];
  result._image = _bytesFromBase64(jsonObject["image"]);
  result._data = _bytesFromBase64(jsonObject["data"]);
  if (jsonObject["images"] != null) {
    result._images = [];
    for (var item in jsonObject["images"]) {
      result._images!.addSafe(_bytesFromBase64(item));
    }
  }
  if (jsonObject["imageInputData"] != null) {
    result._imageInputData = [];
    for (var item in jsonObject["imageInputData"]) {
      result._imageInputData!.addSafe(ImageInputData.fromJson(item));
    }
  }

  return result;
}