26 lines
733 B
Dart
26 lines
733 B
Dart
import 'dart:convert';
|
|
|
|
import 'FileHashEntry.dart';
|
|
|
|
class LeaderboardEntry{
|
|
int place;
|
|
String username;
|
|
int kills;
|
|
int deaths;
|
|
int assists;
|
|
int xp;
|
|
|
|
LeaderboardEntry(this.place,this.username,this.kills, this.deaths, this.assists,this.xp);
|
|
|
|
static List<LeaderboardEntry> listFromJson(String json){
|
|
List<dynamic> list = jsonDecode(json);
|
|
List<LeaderboardEntry> output = [];
|
|
for(int i= 0; i < list.length; i++){
|
|
if(list[i]==null){continue;}
|
|
LeaderboardEntry entry = LeaderboardEntry(list[i]['place'],list[i]['username'], int.parse(list[i]['kills']), int.parse(list[i]['deaths']), int.parse(list[i]['assists']), int.parse(list[i]['xp']));
|
|
output.add(entry);
|
|
}
|
|
|
|
return output;
|
|
}
|
|
} |