fromJson method
Implementation
fromJson(Map<String, dynamic>? json) {
if (json != null) {
token = json['access_token'];
refreshToken = json['refresh_token'];
tokenType = json['token_type'];
expiry = json['expires_in'];
// check if user
if (json.containsKey("user")) {
user = User.fromJson(json["user"]);
}
// check if device
if (json.containsKey("device")) {
device = Device.fromJson(json["device"]);
}
}
}