DbController class
DbController class that handles database operations related to user data, exercises, and streaks.
Constructors
Properties
- firestore ↔ FirebaseFirestore
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- user ↔ UserModel
-
getter/setter pair
Methods
-
addFavorite(
String email, String exerciseName) → Future< void> - Adds an exercise to favourite exercises of a user.
-
deleteExciseLogsOfExercise(
String exerciseName) → Future< void> - Deletes all logged instances of exercise.
-
deleteUser(
String userEmail) → Future< void> - Deletes user.
-
fetchActiveStreakSteps(
BuildContext context) → Future< String?> - Gets steps of active streak of user.
-
getAllExercises(
) → Future< List< Map< >String, dynamic> > - Returns all exercises.
-
getAllExercisesOfCategory(
String categoryName) → Future< List< Map< >String, dynamic> > - Returns all exercises of one category.
-
getAllUsers(
) → Future< List< UserModel> > - Returns list of all users.
-
getExerciseByName(
String name) → Future< Map< String, dynamic> ?> - Gets exercise including all information.
-
getExercises(
String exerciseName) → Future< List< Map< >String, dynamic> > - Returns all exercises matching exerciseName.
-
getFavouriteExercises(
String email) → Future< List< Map< >String, dynamic> > - Returns all favourite exercises of a user.
-
getFilteredExercises(
{required String email, String? category, bool onlyFavorites = false}) → Future< Map< String, dynamic> > - Returns exercises filtered by category or returns favourites.
-
getNumberOfExercisesByCategory(
String category) → Future< String> - Counts exercise of one category.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeFavorite(
String email, String exerciseName) → Future< void> - Removes exercise from favourites of a user.
-
timestampToString(
Timestamp timestamp) → String - Converts timestamp to string.
-
toggleFavorite(
{required String email, required String exerciseName, required bool isCurrentlyFavorite}) → Future< void> - Changes favourite status of exercise to the opposite of current status.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateUser(
UserModel user) → Future< void> - Updates user data.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited