Guest User

Untitled

a guest
Apr 27th, 2021
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. // To parse this JSON data, do
  2. //
  3. // final mapTop = mapTopFromJson(jsonString);
  4.  
  5. import 'dart:convert';
  6.  
  7. List<Record> mapTopFromJson(String str) =>
  8. List<Record>.from(json.decode(str).map((x) => Record.fromJson(x)));
  9.  
  10. class Record {
  11. Record({
  12. this.id,
  13. this.steamid64,
  14. this.playerName,
  15. this.steamId,
  16. this.serverId,
  17. this.mapId,
  18. this.stage,
  19. this.mode,
  20. this.tickrate,
  21. this.time,
  22. this.teleports,
  23. this.createdOn,
  24. this.updatedOn,
  25. this.updatedBy,
  26. this.recordFilterId,
  27. this.serverName,
  28. this.mapName,
  29. this.points,
  30. this.replayId,
  31. });
  32.  
  33. int? id;
  34. String? steamid64;
  35. String? playerName;
  36. String? steamId;
  37. int? serverId;
  38. int? mapId;
  39. int? stage;
  40. String? mode;
  41. int? tickrate;
  42. double? time;
  43. int? teleports;
  44. DateTime? createdOn;
  45. DateTime? updatedOn;
  46. int? updatedBy;
  47. int? recordFilterId;
  48. String? serverName;
  49. String? mapName;
  50. int? points;
  51. int? replayId;
  52.  
  53. factory Record.fromJson(Map<String, dynamic> json) => Record(
  54. id: json["id"],
  55. steamid64: json["steamid64"],
  56. playerName: json["player_name"],
  57. steamId: json["steam_id"],
  58. serverId: json["server_id"],
  59. mapId: json["map_id"],
  60. stage: json["stage"],
  61. mode: json["mode"],
  62. tickrate: json["tickrate"],
  63. time: json["time"].toDouble(),
  64. teleports: json["teleports"],
  65. createdOn: DateTime.parse(json["created_on"]),
  66. updatedOn: DateTime.parse(json["updated_on"]),
  67. updatedBy: json["updated_by"],
  68. recordFilterId: json["record_filter_id"],
  69. serverName: json["server_name"],
  70. mapName: json["map_name"],
  71. points: json["points"],
  72. replayId: json["replay_id"],
  73. );
  74. }
  75.  
Advertisement
Add Comment
Please, Sign In to add comment