diff --git a/lib/constants.dart b/lib/constants.dart new file mode 100644 index 00000000..278038d0 --- /dev/null +++ b/lib/constants.dart @@ -0,0 +1 @@ +const twitchIrc = 'wss://irc-ws.chat.twitch.tv:443'; diff --git a/lib/models/badges.dart b/lib/models/badges.dart index 8c958a57..dcc81169 100644 --- a/lib/models/badges.dart +++ b/lib/models/badges.dart @@ -10,7 +10,7 @@ class BadgeImagesTwitch { final String imageUrl2x; final String imageUrl4x; - BadgeImagesTwitch(this.id, this.imageUrl1x, this.imageUrl2x, this.imageUrl4x); + const BadgeImagesTwitch(this.id, this.imageUrl1x, this.imageUrl2x, this.imageUrl4x); factory BadgeImagesTwitch.fromJson(Map json) => _$BadgeImagesTwitchFromJson(json); } @@ -20,7 +20,7 @@ class BadgesTwitch { final String setId; final List versions; - BadgesTwitch(this.setId, this.versions); + const BadgesTwitch(this.setId, this.versions); factory BadgesTwitch.fromJson(Map json) => _$BadgesTwitchFromJson(json); } diff --git a/lib/models/channel.dart b/lib/models/channel.dart index 8294539b..7e756c9c 100644 --- a/lib/models/channel.dart +++ b/lib/models/channel.dart @@ -20,7 +20,7 @@ class Channel { final List tagIds; final bool isMature; - Channel(this.id, this.userId, this.userLogin, this.userName, this.gameId, this.gameName, this.type, this.title, this.viewerCount, this.startedAt, + const Channel(this.id, this.userId, this.userLogin, this.userName, this.gameId, this.gameName, this.type, this.title, this.viewerCount, this.startedAt, this.language, this.thumbnailUrl, this.tagIds, this.isMature); factory Channel.fromJson(Map json) => _$ChannelFromJson(json); diff --git a/lib/models/emotes.dart b/lib/models/emotes.dart index 367d8b69..85a02431 100644 --- a/lib/models/emotes.dart +++ b/lib/models/emotes.dart @@ -9,12 +9,12 @@ class ImagesTwitch { final String url2x; final String url4x; - ImagesTwitch(this.url1x, this.url2x, this.url4x); + const ImagesTwitch(this.url1x, this.url2x, this.url4x); factory ImagesTwitch.fromJson(Map json) => _$ImagesTwitchFromJson(json); } -@JsonSerializable(createToJson: false) +@JsonSerializable(createToJson: false, fieldRename: FieldRename.snake) class EmoteTwitch { final String id; final String name; @@ -22,8 +22,11 @@ class EmoteTwitch { final String? tier; final String? emoteType; final String? emoteSetId; + final List format; + final List scale; + final List themeMode; - EmoteTwitch(this.id, this.name, this.images, this.tier, this.emoteType, this.emoteSetId); + const EmoteTwitch(this.id, this.name, this.images, this.tier, this.emoteType, this.emoteSetId, this.format, this.scale, this.themeMode); factory EmoteTwitch.fromJson(Map json) => _$EmoteTwitchFromJson(json); } @@ -36,7 +39,7 @@ class EmoteBTTVGlobal { final String imageType; final String userId; - EmoteBTTVGlobal(this.id, this.code, this.imageType, this.userId); + const EmoteBTTVGlobal(this.id, this.code, this.imageType, this.userId); factory EmoteBTTVGlobal.fromJson(Map json) => _$EmoteBTTVGlobalFromJson(json); } @@ -48,7 +51,7 @@ class UserBTTV { final String displayName; final String providerId; - UserBTTV(this.id, this.name, this.displayName, this.providerId); + const UserBTTV(this.id, this.name, this.displayName, this.providerId); factory UserBTTV.fromJson(Map json) => _$UserBTTVFromJson(json); } @@ -60,7 +63,7 @@ class EmoteBTTVShared { final String imageType; final UserBTTV user; - EmoteBTTVShared(this.id, this.code, this.imageType, this.user); + const EmoteBTTVShared(this.id, this.code, this.imageType, this.user); factory EmoteBTTVShared.fromJson(Map json) => _$EmoteBTTVSharedFromJson(json); } @@ -72,7 +75,7 @@ class EmoteBTTVChannel { final List channelEmotes; final List sharedEmotes; - EmoteBTTVChannel(this.id, this.bots, this.channelEmotes, this.sharedEmotes); + const EmoteBTTVChannel(this.id, this.bots, this.channelEmotes, this.sharedEmotes); factory EmoteBTTVChannel.fromJson(Map json) => _$EmoteBTTVChannelFromJson(json); } @@ -84,7 +87,7 @@ class UserFFZ { final String name; final String displayName; - UserFFZ(this.id, this.name, this.displayName); + const UserFFZ(this.id, this.name, this.displayName); factory UserFFZ.fromJson(Map json) => _$UserFFZFromJson(json); } @@ -98,7 +101,7 @@ class ImagesFFZ { @JsonKey(name: '4x') final String? url4x; - ImagesFFZ(this.url1x, this.url2x, this.url4x); + const ImagesFFZ(this.url1x, this.url2x, this.url4x); factory ImagesFFZ.fromJson(Map json) => _$ImagesFFZFromJson(json); } @@ -111,7 +114,7 @@ class EmoteFFZ { final ImagesFFZ images; final String imageType; - EmoteFFZ(this.id, this.user, this.code, this.images, this.imageType); + const EmoteFFZ(this.id, this.user, this.code, this.images, this.imageType); factory EmoteFFZ.fromJson(Map json) => _$EmoteFFZFromJson(json); } diff --git a/lib/models/emotes.g.dart b/lib/models/emotes.g.dart index 554db7a4..75e8df2e 100644 --- a/lib/models/emotes.g.dart +++ b/lib/models/emotes.g.dart @@ -20,8 +20,11 @@ EmoteTwitch _$EmoteTwitchFromJson(Map json) { json['name'] as String, ImagesTwitch.fromJson(json['images'] as Map), json['tier'] as String?, - json['emoteType'] as String?, - json['emoteSetId'] as String?, + json['emote_type'] as String?, + json['emote_set_id'] as String?, + (json['format'] as List).map((e) => e as String).toList(), + (json['scale'] as List).map((e) => e as String).toList(), + (json['theme_mode'] as List).map((e) => e as String).toList(), ); } diff --git a/lib/models/user.dart b/lib/models/user.dart index ccc6147a..911cad54 100644 --- a/lib/models/user.dart +++ b/lib/models/user.dart @@ -16,7 +16,7 @@ class UserTwitch { final String viewCount; final String createdAt; - UserTwitch(this.id, this.login, this.displayName, this.type, this.broadcasterType, this.description, this.profileImageUrl, this.offlineImageUrl, + const UserTwitch(this.id, this.login, this.displayName, this.type, this.broadcasterType, this.description, this.profileImageUrl, this.offlineImageUrl, this.viewCount, this.createdAt); factory UserTwitch.fromJson(Map json) => _$UserTwitchFromJson(json);