mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
590 B
19 lines
590 B
6 years ago
|
import 'package:github_dataviz/data/contribution_data.dart';
|
||
|
import 'package:github_dataviz/data/user.dart';
|
||
|
|
||
|
class UserContribution {
|
||
|
User user;
|
||
|
List<ContributionData> contributions;
|
||
|
|
||
|
UserContribution(this.user, this.contributions);
|
||
|
|
||
|
static UserContribution fromJson(Map<String, dynamic> jsonMap) {
|
||
|
List<ContributionData> contributionList = (jsonMap["weeks"] as List)
|
||
|
.map((e) => ContributionData.fromJson(e))
|
||
|
.toList();
|
||
|
var userContribution =
|
||
|
UserContribution(User.fromJson(jsonMap["author"]), contributionList);
|
||
|
return userContribution;
|
||
|
}
|
||
|
}
|