PlurkSearch.fromJson constructor

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

Implementation

PlurkSearch.fromJson(Map<String, dynamic> json) {
  Map<String, dynamic>? usersData = json['users'];
  users = Map<int, User>();
  if (usersData != null) {
    usersData.forEach((key, value) {
      int? keyInt = int.tryParse(key);
      if (keyInt != null) {
        users![keyInt] = User.fromJson(value);
      }
    });
  }
  if (json['plurks'] != null) {
    plurks = [];
    json['plurks'].forEach((v) { plurks!.add(new Plurk.fromJson(v)); });
  }

  lastOffset = json['last_offset'];
  hasMore = json['has_more'];
  error = json['error'];
  words = json['words'].cast<String>();
  country = json['country'];
  errorText = json['error_text'];
  successText = json['success_text'];
}