This commit is contained in:
Juan Felipe Duarte
2023-06-05 16:10:43 -05:00
parent d32404d0f4
commit b1dcbfa767
3 changed files with 5 additions and 15 deletions
+4 -6
View File
@@ -10,15 +10,14 @@ class UserModel {
final Reference? photo;
final int? tarifa;
final String? phoneNumber;
final String? token;
UserModel(this.name, this.city, this.profession, this.state, this.photo,
this.tarifa, this.phoneNumber, this.token);
this.tarifa, this.phoneNumber);
static Future<UserModel> fromJson(
Map<String, dynamic>? json, String uid) async {
try {
if (json == null) return UserModel('', '', '', null, null, 0, '', '');
if (json == null) return UserModel('', '', '', null, null, 0, '');
String? avatar = json['photo'];
return UserModel(
@@ -29,11 +28,10 @@ class UserModel {
avatar != null ? storage.ref().child(avatar) : null,
json['tarifa'] ?? 0,
json['phoneNumber'],
json['token'],
);
} catch (e) {
print('XD user $e');
return UserModel('', '', '', null, null, 0, '', '');
return UserModel('', '', '', null, null, 0, '');
}
}
@@ -45,7 +43,7 @@ class UserModel {
return fromJson(data, uid);
} catch (e) {
print('Error getting user: $e');
return UserModel('', '', '', null, null, 0, '', '');
return UserModel('', '', '', null, null, 0, '');
}
}
}