class User { final int id; final String login; final String pwdHash; User({ required this.id, required this.login, required this.pwdHash, }); Map toMap() { return { 'id': id, 'login': login, }; } factory User.fromMap(Map map) { return User( id: map['id'], login: map['login'], pwdHash: map['pwd_hash'], ); } }