This commit is contained in:
Juan Felipe Duarte
2023-05-04 16:07:32 -05:00
parent 1a0e33328e
commit bc1357b7a6
9 changed files with 505 additions and 114 deletions
+6 -4
View File
@@ -5,26 +5,28 @@ import 'package:prosappco/src/screens/professional.dart';
class UserModel {
final String name;
final String city;
final String? profession;
final String? state;
final Reference? photo;
UserModel(this.name, this.city, this.state, this.photo);
UserModel(this.name, this.city, this.profession, this.state, this.photo);
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);
String? avatar = json['photo'];
return UserModel(
json['name'],
json['city'],
json['profesion'],
json['estado'],
avatar != null ? storage.ref().child(avatar) : null,
);
} catch (e) {
print('XD user $e');
return UserModel('', '', null, null);
return UserModel('', '', '', null, null);
}
}
@@ -36,7 +38,7 @@ class UserModel {
return fromJson(data, uid);
} catch (e) {
print('Error getting user: $e');
return UserModel('', '', null, null);
return UserModel('', '', '', null, null);
}
}
}