/
annotation.dart
58 lines (46 loc) · 1.31 KB
/
annotation.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// To parse this JSON data, do
//
// final annotations = annotationsFromJson(jsonString);
import 'dart:convert';
import 'package:get/get.dart';
import 'package:mobile/core/values/keys.dart';
Annotations annotationsFromJson(String str) =>
Annotations.fromJson(json.decode(str));
String annotationsToJson(Annotations data) => json.encode(data.toJson());
class Annotations {
Annotations({
this.annotations,
});
RxList<Rx<Annotation>> annotations;
factory Annotations.fromJson(Map<String, dynamic> json) => Annotations(
annotations: RxList<Rx<Annotation>>.from(
json[ANNOTATIONS].map((x) => Annotation.fromJson(x).obs)),
);
Map<String, dynamic> toJson() => {
ANNOTATIONS: RxList<dynamic>.from(annotations.map((x) => x.toJson())),
};
}
class Annotation {
Annotation({
this.title,
this.date,
this.check,
this.description,
});
String title;
String date;
bool check;
String description;
factory Annotation.fromJson(Map<String, dynamic> json) => Annotation(
title: json["title"],
date: json["date"],
check: json["check"],
description: json["description"],
);
Map<String, dynamic> toJson() => {
"title": title,
"date": date,
"check": check,
"description": description,
};
}