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:
@@ -2,21 +2,48 @@ import 'package:equatable/equatable.dart';
|
||||
import '../../models/settlement.dart';
|
||||
import '../../models/user_balance.dart';
|
||||
|
||||
/// Abstract base class for all balance-related states.
|
||||
///
|
||||
/// This class extends [Equatable] to enable value equality for state comparison.
|
||||
/// All balance states in the application should inherit from this class.
|
||||
abstract class BalanceState extends Equatable {
|
||||
/// Creates a new [BalanceState].
|
||||
const BalanceState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
/// Initial state of the balance bloc.
|
||||
///
|
||||
/// This state represents the initial state before any balance
|
||||
/// operations have been performed.
|
||||
class BalanceInitial extends BalanceState {}
|
||||
|
||||
/// State indicating that a balance operation is in progress.
|
||||
///
|
||||
/// This state is used to show loading indicators during balance
|
||||
/// calculations, data loading, or settlement operations.
|
||||
class BalanceLoading extends BalanceState {}
|
||||
|
||||
/// State indicating that group balances have been successfully loaded.
|
||||
///
|
||||
/// This state contains the calculated balances for all group members
|
||||
/// and the list of settlements needed to balance all debts.
|
||||
class GroupBalancesLoaded extends BalanceState {
|
||||
/// List of user balances showing how much each user owes or is owed.
|
||||
///
|
||||
/// Positive balances indicate the user is owed money,
|
||||
/// negative balances indicate the user owes money.
|
||||
final List<UserBalance> balances;
|
||||
|
||||
/// List of settlements required to balance all debts in the group.
|
||||
///
|
||||
/// Each settlement represents a payment that needs to be made
|
||||
/// from one user to another to settle shared expenses.
|
||||
final List<Settlement> settlements;
|
||||
|
||||
/// Creates a [GroupBalancesLoaded] state with the calculated data.
|
||||
const GroupBalancesLoaded({
|
||||
required this.balances,
|
||||
required this.settlements,
|
||||
@@ -26,18 +53,30 @@ class GroupBalancesLoaded extends BalanceState {
|
||||
List<Object> get props => [balances, settlements];
|
||||
}
|
||||
|
||||
/// State indicating that a balance operation has completed successfully.
|
||||
///
|
||||
/// This state is used to show success messages after operations like
|
||||
/// marking settlements as completed or refreshing balance calculations.
|
||||
class BalanceOperationSuccess extends BalanceState {
|
||||
/// Success message to display to the user.
|
||||
final String message;
|
||||
|
||||
/// Creates a [BalanceOperationSuccess] state with the given [message].
|
||||
const BalanceOperationSuccess(this.message);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [message];
|
||||
}
|
||||
|
||||
/// State indicating that a balance operation has failed.
|
||||
///
|
||||
/// This state contains an error message that can be displayed to the user
|
||||
/// when balance operations fail.
|
||||
class BalanceError extends BalanceState {
|
||||
/// The error message describing what went wrong.
|
||||
final String message;
|
||||
|
||||
/// Creates a [BalanceError] state with the given error [message].
|
||||
const BalanceError(this.message);
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user