cargo66/lib/data/models/user/authentication_response_mod...

29 lines
772 B
Dart
Raw Normal View History

2024-07-23 06:37:42 +00:00
import 'dart:convert';
import 'user_model.dart';
AuthenticationResponseModel authenticationResponseModelFromJson(String str) =>
AuthenticationResponseModel.fromJson(json.decode(str));
String authenticationResponseModelToJson(AuthenticationResponseModel data) => json.encode(data.toJson());
class AuthenticationResponseModel {
final String token;
final UserModel user;
const AuthenticationResponseModel({
required this.token,
required this.user,
});
factory AuthenticationResponseModel.fromJson(Map<String, dynamic> json) => AuthenticationResponseModel(
token: json['token'],
user: UserModel.fromJson(json['user']),
);
Map<String, dynamic> toJson() => {
'token': token,
'user': user.toJson(),
};
}