76 lines
2.2 KiB
Dart
76 lines
2.2 KiB
Dart
/// The abstract base class for all account-related states used by the AccountBloc.
|
|
///
|
|
/// Extends Equatable to enable value-based comparisons between state
|
|
/// instances. Subclasses should provide the relevant properties by
|
|
/// overriding `props` so that the bloc can correctly determine whether
|
|
/// the state has changed.
|
|
library;
|
|
|
|
/// Represents the initial state of the account feature.
|
|
///
|
|
/// Used before any account-related action has started or when the bloc
|
|
/// has been freshly created.
|
|
|
|
/// Indicates that an account-related operation is currently in progress.
|
|
///
|
|
/// This state is typically emitted while fetching account data, creating,
|
|
/// updating, or deleting an account so the UI can show a loading indicator.
|
|
|
|
/// Emitted when a collection of accounts has been successfully loaded.
|
|
///
|
|
/// Contains:
|
|
/// - `accounts`: the list of Account models retrieved from the repository.
|
|
///
|
|
/// Use this state to display fetched account data in the UI.
|
|
|
|
/// Represents a successful account operation that does not necessarily
|
|
/// carry account data (e.g., after creating, updating, or deleting an account).
|
|
///
|
|
/// Contains:
|
|
/// - `message`: a human-readable success message that can be shown to the user.
|
|
|
|
/// Represents an error that occurred during an account-related operation.
|
|
///
|
|
/// Contains:
|
|
/// - `message`: a human-readable error description suitable for logging
|
|
/// or displaying to the user.
|
|
import 'package:equatable/equatable.dart';
|
|
import '../../models/account.dart';
|
|
|
|
abstract class AccountState extends Equatable {
|
|
const AccountState();
|
|
|
|
@override
|
|
List<Object?> get props => [];
|
|
}
|
|
|
|
class AccountInitial extends AccountState {}
|
|
|
|
class AccountLoading extends AccountState {}
|
|
|
|
class AccountsLoaded extends AccountState {
|
|
final List<Account> accounts;
|
|
|
|
const AccountsLoaded(this.accounts);
|
|
|
|
@override
|
|
List<Object?> get props => [accounts];
|
|
}
|
|
|
|
class AccountOperationSuccess extends AccountState {
|
|
final String message;
|
|
|
|
const AccountOperationSuccess(this.message);
|
|
|
|
@override
|
|
List<Object?> get props => [message];
|
|
}
|
|
|
|
class AccountError extends AccountState {
|
|
final String message;
|
|
|
|
const AccountError(this.message);
|
|
|
|
@override
|
|
List<Object?> get props => [message];
|
|
} |