36 lines
824 B
Dart
36 lines
824 B
Dart
class ProfileModel {
|
|
const ProfileModel({
|
|
required this.userId,
|
|
required this.username,
|
|
required this.bio,
|
|
required this.avatarUrl,
|
|
});
|
|
|
|
final String userId;
|
|
final String username;
|
|
final String bio;
|
|
final String avatarUrl;
|
|
|
|
factory ProfileModel.fromJson(Map<String, dynamic> json) {
|
|
return ProfileModel(
|
|
userId: (json['user_id'] as String?) ?? '',
|
|
username: (json['username'] as String?) ?? '',
|
|
bio: (json['bio'] as String?) ?? '',
|
|
avatarUrl: (json['avatar_url'] as String?) ?? '',
|
|
);
|
|
}
|
|
|
|
ProfileModel copyWith({
|
|
String? username,
|
|
String? bio,
|
|
String? avatarUrl,
|
|
}) {
|
|
return ProfileModel(
|
|
userId: userId,
|
|
username: username ?? this.username,
|
|
bio: bio ?? this.bio,
|
|
avatarUrl: avatarUrl ?? this.avatarUrl,
|
|
);
|
|
}
|
|
}
|