dreampad/lib/app/models/token_model.dart

44 lines
860 B
Dart
Raw Normal View History

2023-11-28 10:44:58 +08:00
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;
}
}