diff --git a/lib/models/plex_home.dart b/lib/models/plex_home.dart index 99a200e5..0554ff16 100644 --- a/lib/models/plex_home.dart +++ b/lib/models/plex_home.dart @@ -3,7 +3,7 @@ import 'plex_home_user.dart'; class PlexHome { final int id; final String name; - final int guestUserID; + final int? guestUserID; final String guestUserUUID; final bool guestEnabled; final bool subscription; @@ -28,9 +28,9 @@ class PlexHome { .toList(); return PlexHome( - id: json['id'] as int, + id: (json['id'] as num?)?.toInt() ?? 0, name: json['name'] as String, - guestUserID: json['guestUserID'] as int, + guestUserID: (json['guestUserID'] as num?)?.toInt(), guestUserUUID: json['guestUserUUID'] as String, guestEnabled: json['guestEnabled'] as bool, subscription: json['subscription'] as bool, diff --git a/lib/models/plex_home_user.dart b/lib/models/plex_home_user.dart index 4efabb27..5c5c1f60 100644 --- a/lib/models/plex_home_user.dart +++ b/lib/models/plex_home_user.dart @@ -8,7 +8,7 @@ class PlexHomeUser { final String thumb; final bool hasPassword; final bool restricted; - final int updatedAt; + final int? updatedAt; final bool admin; final bool guest; final bool protected; @@ -31,7 +31,7 @@ class PlexHomeUser { factory PlexHomeUser.fromJson(Map json) { return PlexHomeUser( - id: json['id'] as int, + id: (json['id'] as num?)?.toInt() ?? 0, uuid: json['uuid'] as String, title: json['title'] as String, username: json['username'] as String?, @@ -40,7 +40,7 @@ class PlexHomeUser { thumb: json['thumb'] as String, hasPassword: json['hasPassword'] as bool, restricted: json['restricted'] as bool, - updatedAt: json['updatedAt'] as int, + updatedAt: (json['updatedAt'] as num?)?.toInt(), admin: json['admin'] as bool, guest: json['guest'] as bool, protected: json['protected'] as bool,