Skip to content

Commit

Permalink
[#1] Feat: 유저 모델 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
cucumber99 committed Jun 27, 2024
1 parent 832d30a commit a149551
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/models/user.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class User {
final String? name;
final String? email;
List<String>? followingList;

User({required this.name, required this.email, this.followingList});

Map<String, dynamic> toJson() {
return {
'userName': name,
'email': email,
};
}

factory User.fromJson(Map<String, dynamic> json) {
return User(
name: json['userName'] as String?,
email: json['email'] as String?,
followingList: json['followingList'] != null ? List<String>.from(json['followingList']) : null
);
}

User copyWith({String? name, String? email, List<String>? followingList}) {
return User(
name: name ?? this.name,
email: email ?? this.email,
followingList: followingList ?? this.followingList
);
}
}

0 comments on commit a149551

Please sign in to comment.