License.fromJson constructor

License.fromJson(
  1. Object? j
)

Implementation

factory License.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return License(
    allowedReplacementLicenses: switch (json['allowedReplacementLicenses']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"allowedReplacementLicenses" is not a list',
      ),
    },
    appendableToDisk: switch (json['appendableToDisk']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    chargesUseFee: switch (json['chargesUseFee']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    incompatibleLicenses: switch (json['incompatibleLicenses']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"incompatibleLicenses" is not a list',
      ),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    licenseCode: switch (json['licenseCode']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    minimumRetention: switch (json['minimumRetention']) {
      null => null,
      Object $1 => Duration.fromJson($1),
    },
    multiTenantOnly: switch (json['multiTenantOnly']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    osLicense: switch (json['osLicense']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    params: switch (json['params']) {
      null => null,
      Object $1 => LicenseParams.fromJson($1),
    },
    removableFromDisk: switch (json['removableFromDisk']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    requiredCoattachedLicenses: switch (json['requiredCoattachedLicenses']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException(
        '"requiredCoattachedLicenses" is not a list',
      ),
    },
    resourceRequirements: switch (json['resourceRequirements']) {
      null => null,
      Object $1 => LicenseResourceRequirements.fromJson($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    selfLinkWithId: switch (json['selfLinkWithId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    soleTenantOnly: switch (json['soleTenantOnly']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    transferable: switch (json['transferable']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    updateTimestamp: switch (json['updateTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}