fix: make profile fields optional
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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<String, dynamic> 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,
|
||||
|
||||
Reference in New Issue
Block a user