update y uso de provider
This commit is contained in:
@@ -37,6 +37,30 @@ class UserModel {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserModel(name: $name, city: $city, profession: $profession, state: $state, tarifa: $tarifa, phoneNumber: $phoneNumber, token: $token)';
|
||||
}
|
||||
|
||||
static UserModel fromFirestore(Map<String, dynamic> firestoreMap) {
|
||||
try {
|
||||
String? avatar = firestoreMap['photo'];
|
||||
return UserModel(
|
||||
firestoreMap['name'] ?? 'Sin nombre',
|
||||
firestoreMap['city'] ?? 'Sin ciudad',
|
||||
firestoreMap['profesion'],
|
||||
firestoreMap['estado'],
|
||||
avatar != null ? storage.ref().child(avatar) : null,
|
||||
firestoreMap['tarifa'] ?? 0,
|
||||
firestoreMap['phoneNumber'] ?? 'Sin numero',
|
||||
firestoreMap['token'],
|
||||
);
|
||||
} catch (e) {
|
||||
print('DesdeProvider $e');
|
||||
return UserModel('', '', '', null, null, 0, '', '');
|
||||
}
|
||||
}
|
||||
|
||||
static Future<UserModel> getUser(String uid) async {
|
||||
try {
|
||||
final snapshot =
|
||||
|
||||
Reference in New Issue
Block a user