fromJson static method

RequestResult fromJson(
  1. dynamic data
)

Implementation

static RequestResult fromJson(dynamic data) {
  dynamic json = data;
  if (data.runtimeType == String) {
    json = jsonDecode(data);
  }

  return RequestResult(
    json.containsKey('folderId') ? json['folderId'] as String? : null,
    json.containsKey('type')
        ? (json['type'] as String).typeFromString()
        : null,
    json.containsKey('errorCode') ? json['errorCode'] as int? : null,
    json.containsKey('errorMessage') ? json['errorMessage'] as String? : null,
    json.containsKey('mode')
        ? (json['mode'] as String).modeFromString()
        : null,
    _parseConfidenceScore(json['confidenceScore']),
    json.containsKey('resolution')
        ? (json['resolution'] as String).resolutionFromString()
        : null,
    json['status'] as bool? ?? false,
  );
}