fromJson static method

Secret fromJson(
  1. Object? json
)

Implementation

static Secret fromJson(Object? json) {
  if (json is! Map ||
      json['namespace'] is! String ||
      json['name'] is! String ||
      json['value'] is! String ||
      json['createdAt'] is! String) {
    throw FormatException('Secret: malformed json $json');
  }
  final version = json['version'];
  return Secret(
    namespace: json['namespace'],
    name: json['name'],
    value: json['value'],
    version: version is int ? version : null,
    createdAt: DateTime.parse(json['createdAt']),
  );
}