Enhance model and service documentation with detailed comments and descriptions

- 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.
This commit is contained in:
Dayron
2025-10-30 15:56:17 +01:00
parent 1eeea6997e
commit 2faf37f145
46 changed files with 2656 additions and 220 deletions

View File

@@ -1,6 +1,24 @@
/// States for group-related operations in the GroupBloc.
///
/// This file defines all possible states that the GroupBloc can emit in response
/// to group-related events. The states represent different phases of group
/// operations including loading, success, error, and data states.
///
/// State Categories:
/// - **Initial State**: GroupInitial
/// - **Loading States**: GroupLoading
/// - **Success States**: GroupsLoaded, GroupLoaded, GroupCreated, GroupOperationSuccess
/// - **Error States**: GroupError
///
/// All states extend [GroupState] and implement [Equatable] for proper
/// equality comparison and state change detection in the BLoC pattern.
import 'package:equatable/equatable.dart';
import '../../models/group.dart';
/// Base class for all group-related states.
///
/// All group states must extend this class and implement the [props] getter
/// for proper equality comparison in the BLoC pattern.
abstract class GroupState extends Equatable {
const GroupState();
@@ -8,54 +26,132 @@ abstract class GroupState extends Equatable {
List<Object?> get props => [];
}
// État initial
// Initial state
/// The initial state of the GroupBloc before any operations are performed.
///
/// This is the default state when the bloc is first created and represents
/// a clean slate with no group data loaded or operations in progress.
class GroupInitial extends GroupState {}
// Chargement
// Loading
/// State indicating that a group operation is currently in progress.
///
/// This state is emitted when the bloc is performing operations like
/// loading groups, creating groups, or updating group information.
/// UI components can use this state to show loading indicators.
class GroupLoading extends GroupState {}
// Groupes chargés
// Groups loaded
/// State containing a list of successfully loaded groups.
///
/// This state is emitted when groups have been successfully retrieved
/// from the repository, either through initial loading or real-time updates.
/// The UI can use this data to display the list of available groups.
///
/// Properties:
/// [groups]: List of Group objects that were loaded
class GroupsLoaded extends GroupState {
/// The list of loaded groups
final List<Group> groups;
/// Creates a GroupsLoaded state.
///
/// Args:
/// [groups]: The list of groups to include in this state
const GroupsLoaded(this.groups);
@override
List<Object?> get props => [groups];
}
/// Alternative state for loaded groups (used in some contexts).
///
/// This state serves a similar purpose to GroupsLoaded but may be used
/// in different contexts or for backward compatibility.
///
/// Properties:
/// [groups]: List of Group objects that were loaded
class GroupLoaded extends GroupState {
/// The list of loaded groups
final List<Group> groups;
/// Creates a GroupLoaded state.
///
/// Args:
/// [groups]: The list of groups to include in this state
const GroupLoaded(this.groups);
}
/// State indicating successful group creation.
///
/// This state is emitted when a new group has been successfully created.
/// It contains the ID of the newly created group and an optional success message
/// that can be displayed to the user.
///
/// Properties:
/// [groupId]: The unique identifier of the newly created group
/// [message]: A success message to display to the user
class GroupCreated extends GroupState {
/// The unique identifier of the newly created group
final String groupId;
/// Success message for the user
final String message;
/// Creates a GroupCreated state.
///
/// Args:
/// [groupId]: The ID of the newly created group
/// [message]: Optional success message (defaults to "Group created successfully")
const GroupCreated({
required this.groupId,
this.message = 'Groupe créé avec succès',
this.message = 'Group created successfully',
});
@override
List<Object?> get props => [groupId, message];
}
// Succès d'une opération
// Operation success
/// State indicating successful completion of a group operation.
///
/// This state is emitted when operations like updating, deleting, or
/// member management have completed successfully. It contains a message
/// that can be displayed to inform the user of the successful operation.
///
/// Properties:
/// [message]: A success message describing the completed operation
class GroupOperationSuccess extends GroupState {
/// The success message to display to the user
final String message;
/// Creates a GroupOperationSuccess state.
///
/// Args:
/// [message]: The success message to display
const GroupOperationSuccess(this.message);
@override
List<Object?> get props => [message];
}
// Erreur
// Error
/// State indicating that a group operation has failed.
///
/// This state is emitted when any group operation encounters an error.
/// It contains an error message that can be displayed to the user to
/// explain what went wrong.
///
/// Properties:
/// [message]: An error message describing what went wrong
class GroupError extends GroupState {
/// The error message to display to the user
final String message;
/// Creates a GroupError state.
///
/// Args:
/// [message]: The error message to display
const GroupError(this.message);
@override