Fix channel crash
Tag ids are null when a channel just went live. They're now nullable.
This commit is contained in:
parent
5791f988b1
commit
a026d4f74c
2 changed files with 3 additions and 4 deletions
|
|
@ -2,8 +2,6 @@ import 'package:json_annotation/json_annotation.dart';
|
|||
|
||||
part 'channel.g.dart';
|
||||
|
||||
// ! Seems like when a channel just went live (< 2 min), tagIds are null. Possibly make it optional.
|
||||
|
||||
// Twitch Channels (Streams)
|
||||
@JsonSerializable(createToJson: false, fieldRename: FieldRename.snake)
|
||||
class Channel {
|
||||
|
|
@ -19,7 +17,7 @@ class Channel {
|
|||
final String startedAt;
|
||||
final String language;
|
||||
final String thumbnailUrl;
|
||||
final List<String> tagIds;
|
||||
final List<String>? tagIds;
|
||||
final bool isMature;
|
||||
|
||||
const Channel({
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ Channel _$ChannelFromJson(Map<String, dynamic> json) {
|
|||
startedAt: json['started_at'] as String,
|
||||
language: json['language'] as String,
|
||||
thumbnailUrl: json['thumbnail_url'] as String,
|
||||
tagIds: (json['tag_ids'] as List<dynamic>).map((e) => e as String).toList(),
|
||||
tagIds:
|
||||
(json['tag_ids'] as List<dynamic>?)?.map((e) => e as String).toList(),
|
||||
isMature: json['is_mature'] as bool,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue