Key.fromJson constructor

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

Implementation

factory Key.fromJson(Map<String, dynamic> json) {
  return Key(
    type: KeyType.fromJson(json['type'] as String),
    number: json.containsKey('number') ? json['number'] as num : null,
    string: json.containsKey('string') ? json['string'] as String : null,
    date: json.containsKey('date') ? json['date'] as num : null,
    array: json.containsKey('array')
        ? (json['array'] as List)
            .map((e) => Key.fromJson(e as Map<String, dynamic>))
            .toList()
        : null,
  );
}