QuotaLimit.fromJson constructor

QuotaLimit.fromJson(
  1. Object? j
)

Implementation

factory QuotaLimit.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return QuotaLimit(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($1),
    },
    defaultLimit: switch (json['defaultLimit']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    maxLimit: switch (json['maxLimit']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    freeTier: switch (json['freeTier']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    duration: switch (json['duration']) {
      null => '',
      Object $1 => decodeString($1),
    },
    metric: switch (json['metric']) {
      null => '',
      Object $1 => decodeString($1),
    },
    unit: switch (json['unit']) {
      null => '',
      Object $1 => decodeString($1),
    },
    values: switch (json['values']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries) decodeString(e.key): decodeInt64(e.value),
      },
      _ => throw const FormatException('"values" is not an object'),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
  );
}