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.image = _bytesFromBase64(jsonObject["image"]);
  if (jsonObject["images"] != null) {
    result.images = [];
    for (var item in jsonObject["images"]) {
      result.images!.addSafe(_bytesFromBase64(item));
    }
  }
  result.data = _bytesFromBase64(jsonObject["data"]);
  if (jsonObject["imageInputData"] != null) {
    result.imageInputData = [];
    for (var item in jsonObject["imageInputData"]) {
      result.imageInputData!.addSafe(ImageInputData.fromJson(item));
    }
  }
  result.dtc = _bytesFromBase64(jsonObject["dtc"]);
  result.livePortrait = _bytesFromBase64(jsonObject["livePortrait"]);
  result.extPortrait = _bytesFromBase64(jsonObject["extPortrait"]);
  result.oneShotIdentification = jsonObject["oneShotIdentification"];

  return result;
}