35 lines
859 B
Dart
35 lines
859 B
Dart
|
class User {
|
||
|
final int id;
|
||
|
final String? username;
|
||
|
final String? firstName;
|
||
|
final String? lastName;
|
||
|
final String? email;
|
||
|
final bool? isActive;
|
||
|
|
||
|
User({
|
||
|
required this.id,
|
||
|
required this.username,
|
||
|
required this.firstName,
|
||
|
required this.lastName,
|
||
|
required this.email,
|
||
|
required this.isActive,
|
||
|
});
|
||
|
|
||
|
factory User.fromJson(Map<String, dynamic> json) => User(
|
||
|
id: json["id"],
|
||
|
username: json["username"],
|
||
|
firstName: json["first_name"],
|
||
|
lastName: json["last_name"],
|
||
|
email: json["email"],
|
||
|
isActive: json["is_active"],
|
||
|
);
|
||
|
|
||
|
Map<String, dynamic> toJson() => {
|
||
|
"id": id,
|
||
|
"username": username,
|
||
|
"first_name": firstName,
|
||
|
"last_name": lastName,
|
||
|
"email": email,
|
||
|
"is_active": isActive,
|
||
|
};
|
||
|
}
|