fromJson static method

MmEnvironmentConfigFileSettings? fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static MmEnvironmentConfigFileSettings? 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(() {
      requiredKeys.forEach((key) {
        assert(json.containsKey(key), 'Required key "MmEnvironmentConfigFileSettings[$key]" is missing from JSON.');
        assert(json[key] != null, 'Required key "MmEnvironmentConfigFileSettings[$key]" has a null value in JSON.');
      });
      return true;
    }());

    return MmEnvironmentConfigFileSettings(
      maxFileSize: mapValueOfType<bool>(json, r'MaxFileSize'),
      driverName: mapValueOfType<bool>(json, r'DriverName'),
      directory: mapValueOfType<bool>(json, r'Directory'),
      enablePublicLink: mapValueOfType<bool>(json, r'EnablePublicLink'),
      publicLinkSalt: mapValueOfType<bool>(json, r'PublicLinkSalt'),
      thumbnailWidth: mapValueOfType<bool>(json, r'ThumbnailWidth'),
      thumbnailHeight: mapValueOfType<bool>(json, r'ThumbnailHeight'),
      previewWidth: mapValueOfType<bool>(json, r'PreviewWidth'),
      previewHeight: mapValueOfType<bool>(json, r'PreviewHeight'),
      profileWidth: mapValueOfType<bool>(json, r'ProfileWidth'),
      profileHeight: mapValueOfType<bool>(json, r'ProfileHeight'),
      initialFont: mapValueOfType<bool>(json, r'InitialFont'),
      amazonS3AccessKeyId: mapValueOfType<bool>(json, r'AmazonS3AccessKeyId'),
      amazonS3SecretAccessKey: mapValueOfType<bool>(json, r'AmazonS3SecretAccessKey'),
      amazonS3Bucket: mapValueOfType<bool>(json, r'AmazonS3Bucket'),
      amazonS3Region: mapValueOfType<bool>(json, r'AmazonS3Region'),
      amazonS3Endpoint: mapValueOfType<bool>(json, r'AmazonS3Endpoint'),
      amazonS3SSL: mapValueOfType<bool>(json, r'AmazonS3SSL'),
    );
  }
  return null;
}