- Updated Group, Trip, User, and other model classes to include comprehensive documentation for better understanding and maintainability. - Improved error handling and logging in services, including AuthService, ErrorService, and StorageService. - Added validation and business logic explanations in ExpenseService and TripService. - Refactored method comments to follow a consistent format across the codebase. - Translated error messages and comments from French to English for consistency.
48 lines
1.6 KiB
Dart
48 lines
1.6 KiB
Dart
/// Abstract base class for all user-related events.
|
|
///
|
|
/// All user events in the application should inherit from this class.
|
|
/// This provides a common interface for user-related operations.
|
|
abstract class UserEvent {}
|
|
|
|
/// Event to initialize the current user's data.
|
|
///
|
|
/// This event is typically dispatched when the app starts or when
|
|
/// a user signs in to load their profile information from Firestore.
|
|
class UserInitialized extends UserEvent {}
|
|
|
|
/// Event to load a specific user's data by their ID.
|
|
///
|
|
/// This event is used to fetch user information from Firestore
|
|
/// when you need to display or work with a specific user's data.
|
|
class LoadUser extends UserEvent {
|
|
/// The ID of the user to load.
|
|
final String userId;
|
|
|
|
/// Creates a [LoadUser] event with the specified [userId].
|
|
LoadUser(this.userId);
|
|
}
|
|
|
|
/// Event to update the current user's data.
|
|
///
|
|
/// This event is dispatched when the user modifies their profile
|
|
/// information and the changes need to be saved to Firestore.
|
|
class UserUpdated extends UserEvent {
|
|
/// Map containing the user data fields to update.
|
|
///
|
|
/// Only the fields present in this map will be updated in Firestore.
|
|
/// This allows for partial updates of user information.
|
|
final Map<String, dynamic> userData;
|
|
|
|
/// Creates a [UserUpdated] event with the specified [userData].
|
|
UserUpdated(this.userData);
|
|
}
|
|
|
|
/// Event to handle user logout.
|
|
///
|
|
/// This event is dispatched when the user signs out of the application,
|
|
/// clearing their data from the user bloc state.
|
|
class UserLoggedOut extends UserEvent {
|
|
/// Creates a [UserLoggedOut] event.
|
|
UserLoggedOut();
|
|
}
|