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:
@@ -1,36 +1,68 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Abstract base class for all balance-related events.
|
||||
///
|
||||
/// This class extends [Equatable] to enable value equality for event comparison.
|
||||
/// All balance events in the application should inherit from this class.
|
||||
abstract class BalanceEvent extends Equatable {
|
||||
/// Creates a new [BalanceEvent].
|
||||
const BalanceEvent();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
/// Event to load balance information for a specific group.
|
||||
///
|
||||
/// This event triggers the loading of user balances and settlements
|
||||
/// for all members of the specified group. It calculates who owes
|
||||
/// money to whom based on shared expenses.
|
||||
class LoadGroupBalances extends BalanceEvent {
|
||||
/// The ID of the group to load balances for.
|
||||
final String groupId;
|
||||
|
||||
/// Creates a [LoadGroupBalances] event for the specified [groupId].
|
||||
const LoadGroupBalances(this.groupId);
|
||||
|
||||
@override
|
||||
List<Object> get props => [groupId];
|
||||
}
|
||||
|
||||
/// Event to refresh balance calculations for a group.
|
||||
///
|
||||
/// This event recalculates all balances and settlements for a group,
|
||||
/// typically called after expenses are added, modified, or deleted.
|
||||
class RefreshBalance extends BalanceEvent {
|
||||
/// The ID of the group to refresh balances for.
|
||||
final String groupId;
|
||||
|
||||
/// Creates a [RefreshBalance] event for the specified [groupId].
|
||||
const RefreshBalance(this.groupId);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [groupId];
|
||||
}
|
||||
|
||||
/// Event to mark a settlement as completed between two users.
|
||||
///
|
||||
/// This event is dispatched when one user pays back money they owe
|
||||
/// to another user, updating the balance calculations accordingly.
|
||||
class MarkSettlementAsCompleted extends BalanceEvent {
|
||||
/// The ID of the group where the settlement occurred.
|
||||
final String groupId;
|
||||
|
||||
/// The ID of the user who is paying the debt.
|
||||
final String fromUserId;
|
||||
|
||||
/// The ID of the user who is receiving the payment.
|
||||
final String toUserId;
|
||||
|
||||
/// The amount being settled.
|
||||
final double amount;
|
||||
|
||||
/// Creates a [MarkSettlementAsCompleted] event with the settlement details.
|
||||
///
|
||||
/// All parameters are required to properly record the settlement.
|
||||
const MarkSettlementAsCompleted({
|
||||
required this.groupId,
|
||||
required this.fromUserId,
|
||||
|
||||
Reference in New Issue
Block a user