Added docs for the user model

This commit is contained in:
Mariano Uvalle 2019-04-05 14:22:48 -06:00
parent a641d88427
commit a0ac18464e

View file

@ -29,6 +29,7 @@ class UserModel {
/// Pending low priority tasks. /// Pending low priority tasks.
final int pendingLow; final int pendingLow;
/// Creates a user model.
UserModel({ UserModel({
this.id, this.id,
@required this.username, @required this.username,
@ -40,8 +41,12 @@ class UserModel {
@required this.events, @required this.events,
}); });
///Returns a [UserModel] from a map. ///Create a [UserModel] from a map.
UserModel.fromFirestore(Map<String, dynamic> firestoreMap, {String id}) ///
/// The database id for the event is not provided inside the map but should
/// always be specified.
UserModel.fromFirestore(Map<String, dynamic> firestoreMap,
{@required String id})
: id = id, : id = id,
username = firestoreMap["username"], username = firestoreMap["username"],
tasks = firestoreMap["tasks"].cast<String>(), tasks = firestoreMap["tasks"].cast<String>(),
@ -52,6 +57,7 @@ class UserModel {
pendingMedium = firestoreMap["pendingMedium"], pendingMedium = firestoreMap["pendingMedium"],
pendingLow = firestoreMap["pendingLow"]; pendingLow = firestoreMap["pendingLow"];
/// Returns a map representation of the user model.
Map<String, dynamic> toFirestoreMap() { Map<String, dynamic> toFirestoreMap() {
return <String, dynamic>{ return <String, dynamic>{
"username": username, "username": username,