♻️ Use controller instead of state to manage history
This commit is contained in:
@ -81,24 +81,24 @@ class AccountBadge {
|
||||
});
|
||||
|
||||
factory AccountBadge.fromJson(Map<String, dynamic> json) => AccountBadge(
|
||||
id: json["id"],
|
||||
accountId: json["account_id"],
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
deletedAt: json["deleted_at"] != null
|
||||
? DateTime.parse(json["deleted_at"])
|
||||
id: json['id'],
|
||||
accountId: json['account_id'],
|
||||
updatedAt: DateTime.parse(json['updated_at']),
|
||||
createdAt: DateTime.parse(json['created_at']),
|
||||
deletedAt: json['deleted_at'] != null
|
||||
? DateTime.parse(json['deleted_at'])
|
||||
: null,
|
||||
metadata: json["metadata"],
|
||||
type: json["type"],
|
||||
metadata: json['metadata'],
|
||||
type: json['type'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"account_id": accountId,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt.toIso8601String(),
|
||||
"deleted_at": deletedAt?.toIso8601String(),
|
||||
"metadata": metadata,
|
||||
"type": type,
|
||||
'id': id,
|
||||
'account_id': accountId,
|
||||
'created_at': createdAt.toIso8601String(),
|
||||
'updated_at': updatedAt.toIso8601String(),
|
||||
'deleted_at': deletedAt?.toIso8601String(),
|
||||
'metadata': metadata,
|
||||
'type': type,
|
||||
};
|
||||
}
|
||||
|
@ -38,40 +38,40 @@ class Attachment {
|
||||
});
|
||||
|
||||
factory Attachment.fromJson(Map<String, dynamic> json) => Attachment(
|
||||
id: json["id"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
deletedAt: json["deleted_at"],
|
||||
uuid: json["uuid"],
|
||||
size: json["size"],
|
||||
name: json["name"],
|
||||
alt: json["alt"],
|
||||
usage: json["usage"],
|
||||
mimetype: json["mimetype"],
|
||||
hash: json["hash"],
|
||||
destination: json["destination"],
|
||||
metadata: json["metadata"],
|
||||
isMature: json["is_mature"],
|
||||
account: Account.fromJson(json["account"]),
|
||||
accountId: json["account_id"],
|
||||
id: json['id'],
|
||||
createdAt: DateTime.parse(json['created_at']),
|
||||
updatedAt: DateTime.parse(json['updated_at']),
|
||||
deletedAt: json['deleted_at'],
|
||||
uuid: json['uuid'],
|
||||
size: json['size'],
|
||||
name: json['name'],
|
||||
alt: json['alt'],
|
||||
usage: json['usage'],
|
||||
mimetype: json['mimetype'],
|
||||
hash: json['hash'],
|
||||
destination: json['destination'],
|
||||
metadata: json['metadata'],
|
||||
isMature: json['is_mature'],
|
||||
account: Account.fromJson(json['account']),
|
||||
accountId: json['account_id'],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt.toIso8601String(),
|
||||
"deleted_at": deletedAt,
|
||||
"uuid": uuid,
|
||||
"size": size,
|
||||
"name": name,
|
||||
"alt": alt,
|
||||
"usage": usage,
|
||||
"mimetype": mimetype,
|
||||
"hash": hash,
|
||||
"destination": destination,
|
||||
"metadata": metadata,
|
||||
"is_mature": isMature,
|
||||
"account": account.toJson(),
|
||||
"account_id": accountId,
|
||||
'id': id,
|
||||
'created_at': createdAt.toIso8601String(),
|
||||
'updated_at': updatedAt.toIso8601String(),
|
||||
'deleted_at': deletedAt,
|
||||
'uuid': uuid,
|
||||
'size': size,
|
||||
'name': name,
|
||||
'alt': alt,
|
||||
'usage': usage,
|
||||
'mimetype': mimetype,
|
||||
'hash': hash,
|
||||
'destination': destination,
|
||||
'metadata': metadata,
|
||||
'is_mature': isMature,
|
||||
'account': account.toJson(),
|
||||
'account_id': accountId,
|
||||
};
|
||||
}
|
@ -44,8 +44,8 @@ class Message {
|
||||
deletedAt: json['deleted_at'],
|
||||
content: json['content'],
|
||||
type: json['type'],
|
||||
attachments: json["attachments"] != null
|
||||
? List<int>.from(json["attachments"])
|
||||
attachments: json['attachments'] != null
|
||||
? List<int>.from(json['attachments'])
|
||||
: null,
|
||||
channel:
|
||||
json['channel'] != null ? Channel.fromJson(json['channel']) : null,
|
||||
|
@ -53,36 +53,36 @@ class Post {
|
||||
});
|
||||
|
||||
factory Post.fromJson(Map<String, dynamic> json) => Post(
|
||||
id: json["id"],
|
||||
createdAt: DateTime.parse(json["created_at"]),
|
||||
updatedAt: DateTime.parse(json["updated_at"]),
|
||||
deletedAt: json["deleted_at"] != null
|
||||
id: json['id'],
|
||||
createdAt: DateTime.parse(json['created_at']),
|
||||
updatedAt: DateTime.parse(json['updated_at']),
|
||||
deletedAt: json['deleted_at'] != null
|
||||
? DateTime.parse(json['deleted_at'])
|
||||
: null,
|
||||
alias: json["alias"],
|
||||
content: json["content"],
|
||||
tags: json["tags"],
|
||||
categories: json["categories"],
|
||||
reactions: json["reactions"],
|
||||
replies: json["replies"],
|
||||
attachments: json["attachments"] != null
|
||||
? List<int>.from(json["attachments"])
|
||||
alias: json['alias'],
|
||||
content: json['content'],
|
||||
tags: json['tags'],
|
||||
categories: json['categories'],
|
||||
reactions: json['reactions'],
|
||||
replies: json['replies'],
|
||||
attachments: json['attachments'] != null
|
||||
? List<int>.from(json['attachments'])
|
||||
: null,
|
||||
replyId: json["reply_id"],
|
||||
repostId: json["repost_id"],
|
||||
realmId: json["realm_id"],
|
||||
replyId: json['reply_id'],
|
||||
repostId: json['repost_id'],
|
||||
realmId: json['realm_id'],
|
||||
replyTo:
|
||||
json["reply_to"] != null ? Post.fromJson(json["reply_to"]) : null,
|
||||
json['reply_to'] != null ? Post.fromJson(json['reply_to']) : null,
|
||||
repostTo:
|
||||
json["repost_to"] != null ? Post.fromJson(json["repost_to"]) : null,
|
||||
realm: json["realm"] != null ? Realm.fromJson(json["realm"]) : null,
|
||||
publishedAt: json["published_at"] != null ? DateTime.parse(json["published_at"]) : null,
|
||||
authorId: json["author_id"],
|
||||
author: Account.fromJson(json["author"]),
|
||||
replyCount: json["reply_count"],
|
||||
reactionCount: json["reaction_count"],
|
||||
reactionList: json["reaction_list"] != null
|
||||
? json["reaction_list"]
|
||||
json['repost_to'] != null ? Post.fromJson(json['repost_to']) : null,
|
||||
realm: json['realm'] != null ? Realm.fromJson(json['realm']) : null,
|
||||
publishedAt: json['published_at'] != null ? DateTime.parse(json['published_at']) : null,
|
||||
authorId: json['author_id'],
|
||||
author: Account.fromJson(json['author']),
|
||||
replyCount: json['reply_count'],
|
||||
reactionCount: json['reaction_count'],
|
||||
reactionList: json['reaction_list'] != null
|
||||
? json['reaction_list']
|
||||
.map((key, value) => MapEntry(
|
||||
key,
|
||||
int.tryParse(value.toString()) ??
|
||||
@ -92,28 +92,28 @@ class Post {
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"created_at": createdAt.toIso8601String(),
|
||||
"updated_at": updatedAt.toIso8601String(),
|
||||
"deleted_at": deletedAt,
|
||||
"alias": alias,
|
||||
"content": content,
|
||||
"tags": tags,
|
||||
"categories": categories,
|
||||
"reactions": reactions,
|
||||
"replies": replies,
|
||||
"attachments": attachments,
|
||||
"reply_id": replyId,
|
||||
"repost_id": repostId,
|
||||
"realm_id": realmId,
|
||||
"reply_to": replyTo?.toJson(),
|
||||
"repost_to": repostTo?.toJson(),
|
||||
"realm": realm?.toJson(),
|
||||
"published_at": publishedAt?.toIso8601String(),
|
||||
"author_id": authorId,
|
||||
"author": author.toJson(),
|
||||
"reply_count": replyCount,
|
||||
"reaction_count": reactionCount,
|
||||
"reaction_list": reactionList,
|
||||
'id': id,
|
||||
'created_at': createdAt.toIso8601String(),
|
||||
'updated_at': updatedAt.toIso8601String(),
|
||||
'deleted_at': deletedAt,
|
||||
'alias': alias,
|
||||
'content': content,
|
||||
'tags': tags,
|
||||
'categories': categories,
|
||||
'reactions': reactions,
|
||||
'replies': replies,
|
||||
'attachments': attachments,
|
||||
'reply_id': replyId,
|
||||
'repost_id': repostId,
|
||||
'realm_id': realmId,
|
||||
'reply_to': replyTo?.toJson(),
|
||||
'repost_to': repostTo?.toJson(),
|
||||
'realm': realm?.toJson(),
|
||||
'published_at': publishedAt?.toIso8601String(),
|
||||
'author_id': authorId,
|
||||
'author': author.toJson(),
|
||||
'reply_count': replyCount,
|
||||
'reaction_count': reactionCount,
|
||||
'reaction_list': reactionList,
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user