app mobile allarmi prima
This commit is contained in:
41
lib/models/user.dart
Normal file
41
lib/models/user.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
class User {
|
||||
final int id;
|
||||
final String email;
|
||||
final String nome;
|
||||
final String cognome;
|
||||
final String ruolo;
|
||||
final int clienteId;
|
||||
|
||||
User({
|
||||
required this.id,
|
||||
required this.email,
|
||||
required this.nome,
|
||||
required this.cognome,
|
||||
required this.ruolo,
|
||||
required this.clienteId,
|
||||
});
|
||||
|
||||
factory User.fromJson(Map<String, dynamic> json) {
|
||||
return User(
|
||||
id: json['id'] as int,
|
||||
email: json['email'] as String,
|
||||
nome: json['nome'] as String,
|
||||
cognome: json['cognome'] as String,
|
||||
ruolo: json['ruolo'] as String,
|
||||
clienteId: json['cliente_id'] as int,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'email': email,
|
||||
'nome': nome,
|
||||
'cognome': cognome,
|
||||
'ruolo': ruolo,
|
||||
'cliente_id': clienteId,
|
||||
};
|
||||
}
|
||||
|
||||
String get nomeCompleto => '$nome $cognome';
|
||||
}
|
||||
Reference in New Issue
Block a user