Implemented ParseDateFromJson method.
This commit is contained in:
parent
a7a0e4bf12
commit
43ab1990d7
|
@ -16,8 +16,8 @@ CommentView _$CommentViewFromJson(Map<String, dynamic> json) {
|
||||||
json['content'] as String,
|
json['content'] as String,
|
||||||
json['removed'] as bool,
|
json['removed'] as bool,
|
||||||
json['read'] as bool,
|
json['read'] as bool,
|
||||||
UtilityClass.ParseDateFromJson(json['published']),
|
UtilityClass.ParseDateFromJson(json['published'] as String),
|
||||||
UtilityClass.ParseDateFromJson(json['updated']),
|
UtilityClass.ParseDateFromJson(json['updated'] as String),
|
||||||
json['deleted'] as bool,
|
json['deleted'] as bool,
|
||||||
json['ap_id'] as String,
|
json['ap_id'] as String,
|
||||||
json['local'] as bool,
|
json['local'] as bool,
|
||||||
|
@ -30,7 +30,7 @@ CommentView _$CommentViewFromJson(Map<String, dynamic> json) {
|
||||||
json['creator_actor_id'] as String,
|
json['creator_actor_id'] as String,
|
||||||
json['creator_local'] as bool,
|
json['creator_local'] as bool,
|
||||||
json['creator_name'] as String,
|
json['creator_name'] as String,
|
||||||
UtilityClass.ParseDateFromJson(json['creator_published']),
|
UtilityClass.ParseDateFromJson(json['creator_published'] as String),
|
||||||
json['creator_avatar'] as String,
|
json['creator_avatar'] as String,
|
||||||
json['score'] as int,
|
json['score'] as int,
|
||||||
json['upvotes'] as int,
|
json['upvotes'] as int,
|
||||||
|
|
|
@ -16,8 +16,8 @@ PostView _$PostViewFromJson(Map<String, dynamic> json) {
|
||||||
json['community_id'] as int,
|
json['community_id'] as int,
|
||||||
json['removed'] as bool,
|
json['removed'] as bool,
|
||||||
json['locked'] as bool,
|
json['locked'] as bool,
|
||||||
UtilityClass.ParseDateFromJson(json['published']),
|
UtilityClass.ParseDateFromJson(json['published'] as String),
|
||||||
UtilityClass.ParseDateFromJson(json['updated']),
|
UtilityClass.ParseDateFromJson(json['updated'] as String),
|
||||||
json['deleted'] as bool,
|
json['deleted'] as bool,
|
||||||
json['nsfw'] as bool,
|
json['nsfw'] as bool,
|
||||||
json['stickied'] as bool,
|
json['stickied'] as bool,
|
||||||
|
@ -30,7 +30,7 @@ PostView _$PostViewFromJson(Map<String, dynamic> json) {
|
||||||
json['creator_actor_id'] as String,
|
json['creator_actor_id'] as String,
|
||||||
json['creator_local'] as bool,
|
json['creator_local'] as bool,
|
||||||
json['creator_name'] as String,
|
json['creator_name'] as String,
|
||||||
UtilityClass.ParseDateFromJson(json['creator_published']),
|
UtilityClass.ParseDateFromJson(json['creator_published'] as String),
|
||||||
json['creator_avatar'] as String,
|
json['creator_avatar'] as String,
|
||||||
json['banned'] as bool,
|
json['banned'] as bool,
|
||||||
json['banned_from_community'] as bool,
|
json['banned_from_community'] as bool,
|
||||||
|
@ -45,7 +45,7 @@ PostView _$PostViewFromJson(Map<String, dynamic> json) {
|
||||||
json['upvotes'] as int,
|
json['upvotes'] as int,
|
||||||
json['downvotes'] as int,
|
json['downvotes'] as int,
|
||||||
json['hot_rank'] as int,
|
json['hot_rank'] as int,
|
||||||
UtilityClass.ParseDateFromJson(json['newest_activity_time']),
|
UtilityClass.ParseDateFromJson(json['newest_activity_time'] as String),
|
||||||
json['userId'] as int,
|
json['userId'] as int,
|
||||||
json['myVote'] as int,
|
json['myVote'] as int,
|
||||||
json['subscribed'] as bool,
|
json['subscribed'] as bool,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
class UtilityClass {
|
class UtilityClass {
|
||||||
//TODO: Parse date from Json.
|
///Parses date from Json.
|
||||||
static DateTime ParseDateFromJson(t) {
|
///May return null on wrong argument
|
||||||
throw Exception("Not implemented exception");
|
static DateTime ParseDateFromJson(String t) {
|
||||||
|
return DateTime.tryParse(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue