15 lines
482 B
Dart
15 lines
482 B
Dart
class ChatUser {
|
|
final int id;
|
|
final String name;
|
|
final String? avatar;
|
|
const ChatUser({required this.id, required this.name, this.avatar});
|
|
|
|
factory ChatUser.fromJson(Map<String, dynamic> jsonMap) => ChatUser(
|
|
id: jsonMap["id"],
|
|
name: jsonMap["name"],
|
|
avatar: jsonMap['avatar'],
|
|
);
|
|
//this didn't work because default parameter value must be cosnt and factory cannot be const
|
|
factory ChatUser.zero() => const ChatUser(id: 0, name: '');
|
|
}
|