Make Owner7TV nullable
Some emotes don't have an owner, causing parsing errors and resulting in emotes not showing in chat.
This commit is contained in:
parent
04ac5346a6
commit
bdba3c08d2
2 changed files with 6 additions and 4 deletions
|
|
@ -156,7 +156,7 @@ class Emote7TVData {
|
|||
final String id;
|
||||
final String name;
|
||||
final int flags;
|
||||
final Owner7TV owner;
|
||||
final Owner7TV? owner;
|
||||
final Emote7TVHost host;
|
||||
|
||||
const Emote7TVData(
|
||||
|
|
@ -277,8 +277,8 @@ class Emote {
|
|||
zeroWidth: isZeroWidth,
|
||||
url: 'https:$url/${file.name}',
|
||||
type: type,
|
||||
ownerDisplayName: emoteData.owner.displayName,
|
||||
ownerUsername: emoteData.owner.username,
|
||||
ownerDisplayName: emoteData.owner?.displayName,
|
||||
ownerUsername: emoteData.owner?.username,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ Emote7TVData _$Emote7TVDataFromJson(Map<String, dynamic> json) => Emote7TVData(
|
|||
json['id'] as String,
|
||||
json['name'] as String,
|
||||
json['flags'] as int,
|
||||
Owner7TV.fromJson(json['owner'] as Map<String, dynamic>),
|
||||
json['owner'] == null
|
||||
? null
|
||||
: Owner7TV.fromJson(json['owner'] as Map<String, dynamic>),
|
||||
Emote7TVHost.fromJson(json['host'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue