ResourceQuotaSpec.fromJson constructor

ResourceQuotaSpec.fromJson(
  1. Map<String, dynamic> json
)

Creates a ResourceQuotaSpec from JSON data.

Implementation

factory ResourceQuotaSpec.fromJson(Map<String, dynamic> json) {
  final tempHardJson = json['hard'];
  final tempScopeSelectorJson = json['scopeSelector'];
  final tempScopesJson = json['scopes'];

  final Map<String, String>? tempHard =
      tempHardJson != null ? Map<String, String>.from(tempHardJson) : null;

  final ScopeSelector? tempScopeSelector = tempScopeSelectorJson != null
      ? ScopeSelector.fromJson(tempScopeSelectorJson)
      : null;
  final List<String>? tempScopes =
      tempScopesJson != null ? List<String>.from(tempScopesJson) : null;

  return ResourceQuotaSpec(
    hard: tempHard,
    scopeSelector: tempScopeSelector,
    scopes: tempScopes,
  );
}