Line data Source code
1 : class Gitmoji {
2 : final String emoji;
3 : final String entity;
4 : final String code;
5 : final String description;
6 : final String name;
7 : final String? semver;
8 : final String key;
9 :
10 1 : Gitmoji({
11 : required this.emoji,
12 : required this.entity,
13 : required this.code,
14 : required this.description,
15 : required this.name,
16 : required this.semver,
17 2 : }) : key = '$name $description'.toLowerCase();
18 :
19 1 : factory Gitmoji.fromJson(dynamic map) {
20 1 : if (map is Map<dynamic, dynamic>) {
21 1 : return Gitmoji(
22 2 : emoji: map['emoji'].toString(),
23 2 : entity: map['entity'].toString(),
24 2 : code: map['code'].toString(),
25 3 : description: map['description'].toString().trim(),
26 2 : name: map['name'].toString(),
27 1 : semver: map['semver']?.toString(),
28 : );
29 : } else {
30 0 : throw Exception();
31 : }
32 : }
33 :
34 0 : @override
35 0 : String toString() => '$emoji $description';
36 : }
|