This commit is contained in:
Juan Felipe Duarte
2023-05-10 08:43:40 -05:00
parent eeced3ac66
commit 40ee4f2ab2
30 changed files with 1175 additions and 147 deletions
+12 -10
View File
@@ -8,25 +8,27 @@ class UserModel {
final String? profession;
final String? state;
final Reference? photo;
final int? tarifa;
UserModel(this.name, this.city, this.profession, this.state, this.photo);
UserModel(this.name, this.city, this.profession, this.state, this.photo,
this.tarifa);
static Future<UserModel> fromJson(
Map<String, dynamic>? json, String uid) async {
try {
if (json == null) return UserModel('', '', '', null, null);
if (json == null) return UserModel('', '', '', null, null, 0);
String? avatar = json['photo'];
return UserModel(
json['name'],
json['city'],
json['profesion'],
json['estado'],
avatar != null ? storage.ref().child(avatar) : null,
);
json['name'],
json['city'],
json['profesion'],
json['estado'],
avatar != null ? storage.ref().child(avatar) : null,
json['tarifa'] ?? 0);
} catch (e) {
print('XD user $e');
return UserModel('', '', '', null, null);
return UserModel('', '', '', null, null, 0);
}
}
@@ -38,7 +40,7 @@ class UserModel {
return fromJson(data, uid);
} catch (e) {
print('Error getting user: $e');
return UserModel('', '', '', null, null);
return UserModel('', '', '', null, null, 0);
}
}
}