import 'package:sport/bean/game_record_sum.dart'; import 'package:sport/services/Converter.dart'; class GameRecordHistory { List? records; JogInfo? jogInfo; GameRecordHistory({this.records, this.jogInfo}); GameRecordHistory.fromJson(Map json) { if (json['records'] != null) { records = []; json['records'].forEach((v) { records!.add(GameRecordSum.fromJson(v)); }); } jogInfo = json['jog_info'] != null ? JogInfo.fromJson(json['jog_info']) : null; } Map toJson() { final Map data = new Map(); if (this.records != null) { data['records'] = this.records!.map((v) => v.toJson()).toList(); } if (this.jogInfo != null) { data['jog_info'] = this.jogInfo!.toJson(); } return data; } } class JogInfo { int distanceJog = 0; int durationJog = 0; double stepRateJog = 0; int jogUserCount = 0; JogInfo({this.distanceJog = 0, this.durationJog = 0, this.stepRateJog = 0, this.jogUserCount = 0}); JogInfo.fromJson(Map json) { distanceJog = json['distance_jog']; durationJog = json['duration_jog']; stepRateJog = Converter.toDouble(json['step_rate_jog']); jogUserCount = json['jog_user_count']; } Map toJson() { final Map data = new Map(); data['distance_jog'] = this.distanceJog; data['duration_jog'] = this.durationJog; data['step_rate_jog'] = this.stepRateJog; data['jog_user_count'] = this.jogUserCount; return data; } }