47 lines
1009 B
Dart
47 lines
1009 B
Dart
class User {
|
|
final String id;
|
|
final String name;
|
|
final String email;
|
|
final String phone;
|
|
final String role; // 'seller' atau 'courier'
|
|
final String? profileImage;
|
|
final String? address;
|
|
final bool isActive;
|
|
|
|
User({
|
|
required this.id,
|
|
required this.name,
|
|
required this.email,
|
|
required this.phone,
|
|
required this.role,
|
|
this.profileImage,
|
|
this.address,
|
|
this.isActive = true,
|
|
});
|
|
|
|
factory User.fromJson(Map<String, dynamic> json) {
|
|
return User(
|
|
id: json['id'],
|
|
name: json['name'],
|
|
email: json['email'],
|
|
phone: json['phone'],
|
|
role: json['role'],
|
|
profileImage: json['profile_image'],
|
|
address: json['address'],
|
|
isActive: json['is_active'] ?? true,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'name': name,
|
|
'email': email,
|
|
'phone': phone,
|
|
'role': role,
|
|
'profile_image': profileImage,
|
|
'address': address,
|
|
'is_active': isActive,
|
|
};
|
|
}
|
|
} |