dreampad/lib/app/models/token_model.dart
2023-11-28 10:45:09 +08:00

44 lines
860 B
Dart

class Token {
String? refreshToken;
AccessToken? accessToken;
Token({
this.refreshToken,
this.accessToken,
});
Token.fromJson(Map<String, dynamic> json) {
refreshToken = json['refreshToken'];
accessToken = AccessToken?.fromJson(json['accessToken']);
}
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['refreshToken'] = refreshToken;
data['accessToken'] = accessToken!.toJson();
return data;
}
}
class AccessToken {
String? token;
int? expiresIn;
AccessToken({
this.token,
this.expiresIn,
});
AccessToken.fromJson(Map<String, dynamic> json) {
token = json['token'];
expiresIn = json['expiresIn'];
}
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['token'] = token;
data['expiresIn'] = expiresIn;
return data;
}
}