import 'package:sport/services/Converter.dart'; class SportStep { List records; Sum sum; SportStep({this.records, this.sum}); SportStep.fromJson(Map json) { if (json['records'] != null) { records = new List(); json['records'].forEach((v) { records.add(new Record.fromJson(v)); }); } sum = json['sum'] != null ? new Sum.fromJson(json['sum']) : null; } Map toJson() { final Map data = new Map(); if (this.records != null) { data['records'] = this.records.map((v) => v.toJson()).toList(); } if (this.sum != null) { data['sum'] = this.sum.toJson(); } return data; } } class Record { int id; int userId; int step; int distance; int stepGame; int stepDaily; String createdAt; int year; int month; Record({this.id, this.userId, this.step, this.distance, this.stepGame, this.stepDaily, this.createdAt}); Record.fromJson(Map json) { id = json['id']; userId = json['user_id']; step = json['step']; distance = json['distance']; stepGame = json['step_game']; stepDaily = json['step_daily']; createdAt = json['created_at']; year = json['year']; month = json['month']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['user_id'] = this.userId; data['step'] = this.step; data['distance'] = this.distance; data['step_game'] = this.stepGame; data['step_daily'] = this.stepDaily; data['created_at'] = this.createdAt; return data; } } class Sum { int stepDayAvg; int distance; int step; int stepDaily; int stepGame; double stepRate; double stepRateMax; Sum({this.stepDayAvg, this.distance, this.step, this.stepDaily, this.stepGame, this.stepRate, this.stepRateMax}); Sum.fromJson(Map json) { stepDayAvg = json['step_day_avg']; distance = json['distance']; step = json['step']; stepDaily = json['step_daily']; stepGame = json['step_game']; stepRate = Converter.toDouble(json['step_rate']); stepRateMax = Converter.toDouble(json['step_rate_max']); } Map toJson() { final Map data = new Map(); data['step_day_avg'] = this.stepDayAvg; data['distance'] = this.distance; data['step'] = this.step; data['step_daily'] = this.stepDaily; data['step_game'] = this.stepGame; data['step_rate'] = this.stepRate; data['step_rate_max'] = this.stepRateMax; return data; } }