This repository has been archived on 2025-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
OpenContacts/lib/models/user.dart
2023-04-30 15:43:59 +02:00

25 lines
No EOL
639 B
Dart

import 'package:contacts_plus/models/user_profile.dart';
class User {
final String id;
final String username;
final DateTime registrationDate;
final UserProfile? userProfile;
const User({required this.id, required this.username, required this.registrationDate, this.userProfile});
factory User.fromMap(Map map) {
UserProfile? profile;
try {
profile = UserProfile.fromMap(map["profile"]);
} catch (e) {
profile = null;
}
return User(
id: map["id"],
username: map["username"],
registrationDate: DateTime.parse(map["registrationDate"]),
userProfile: profile,
);
}
}