Refactor database layer: convert to DatabaseProvider class with initialization
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
class User {
|
||||
final int id;
|
||||
final String login;
|
||||
final String pwdHash;
|
||||
|
||||
User({
|
||||
required this.id,
|
||||
required this.login,
|
||||
required this.pwdHash,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'login': login,
|
||||
};
|
||||
}
|
||||
|
||||
factory User.fromMap(Map<String, dynamic> map) {
|
||||
return User(
|
||||
id: map['id'],
|
||||
login: map['login'],
|
||||
pwdHash: map['pwd_hash'],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user