Initial commit: Eventify frontend

This commit is contained in:
Rishad7594
2026-01-31 15:23:18 +05:30
commit b41cf6cc58
193 changed files with 12401 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
class UserModel {
final String username;
final String email;
final String role;
final String token;
final String? phoneNumber;
UserModel({
required this.username,
required this.email,
required this.role,
required this.token,
this.phoneNumber,
});
/// Defensive factory: uses defaults when keys are missing
factory UserModel.fromJson(Map<String, dynamic> json) {
return UserModel(
username: (json['username'] ?? json['email'] ?? '').toString(),
email: (json['email'] ?? '').toString(),
role: (json['role'] ?? 'user').toString(),
token: (json['token'] ?? '').toString(),
phoneNumber: json['phone_number'] != null ? json['phone_number'].toString() : null,
);
}
Map<String, dynamic> toJson() {
return {
'username': username,
'email': email,
'role': role,
'token': token,
if (phoneNumber != null) 'phone_number': phoneNumber,
};
}
}