fromJson static method

ExportPDFR2Response? fromJson(
  1. dynamic value
)

Returns a new ExportPDFR2Response instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static ExportPDFR2Response? fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();

    // Ensure that the map contains the required keys.
    // Note 1: the values aren't checked for validity beyond being non-null.
    // Note 2: this code is stripped in release mode!
    assert(() {
      assert(json.containsKey(r'storage'), 'Required key "ExportPDFR2Response[storage]" is missing from JSON.');
      assert(json[r'storage'] != null, 'Required key "ExportPDFR2Response[storage]" has a null value in JSON.');
      assert(json.containsKey(r'url'), 'Required key "ExportPDFR2Response[url]" is missing from JSON.');
      assert(json[r'url'] != null, 'Required key "ExportPDFR2Response[url]" has a null value in JSON.');
      assert(json.containsKey(r'expiresAt'), 'Required key "ExportPDFR2Response[expiresAt]" is missing from JSON.');
      assert(json[r'expiresAt'] != null, 'Required key "ExportPDFR2Response[expiresAt]" has a null value in JSON.');
      assert(json.containsKey(r'size'), 'Required key "ExportPDFR2Response[size]" is missing from JSON.');
      assert(json[r'size'] != null, 'Required key "ExportPDFR2Response[size]" has a null value in JSON.');
      return true;
    }());

    return ExportPDFR2Response(
      storage: ExportPDFR2ResponseStorageEnum.fromJson(json[r'storage'])!,
      url: mapValueOfType<String>(json, r'url')!,
      expiresAt: mapDateTime(json, r'expiresAt', r'')!,
      size: mapValueOfType<int>(json, r'size')!,
    );
  }
  return null;
}