dfd

mail@pastecode.io avatar
unknown
dart
a year ago
1.5 kB
1
Indexable
Never
class NameIdModel {
  String? key;
  String? message;
  List<Results>? results;
  String? timestamp;

  NameIdModel({this.key, this.message, this.results, this.timestamp});

  NameIdModel.fromJson(Map<String, dynamic> json) {
    key = json['key'];
    message = json['message'];
    if (json['results'] != null) {
      results = <Results>[];
      json['results'].forEach((v) {
        results!.add(new Results.fromJson(v));
      });
    }
    timestamp = json['timestamp'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['key'] = this.key;
    data['message'] = this.message;
    if (this.results != null) {
      data['results'] = this.results!.map((v) => v.toJson()).toList();
    }
    data['timestamp'] = this.timestamp;
    return data;
  }

  @override
  String toString() {
    return 'NameIdModel{key: $key, message: $message, results: $results, timestamp: $timestamp}';
  }
}

class Results {
  String? id;
  String? name;

  Results({this.id, this.name});

  Results.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    return data;
  }

  @override
  String toString() {
    return 'Results{id: $id, name: $name}';
  }
}