50 lines
1.2 KiB
Dart
50 lines
1.2 KiB
Dart
part of 'operation_list_cubit.dart';
|
|
|
|
enum OperationListStatus { initial, loading, success, failure }
|
|
|
|
class OperationListState extends Equatable {
|
|
final OperationListStatus status;
|
|
final List<OperationModel> operations;
|
|
final bool hasReachedMax;
|
|
final String? errorMessage;
|
|
final String query;
|
|
final DateTimeRange? dateRange;
|
|
|
|
const OperationListState({
|
|
this.status = OperationListStatus.initial,
|
|
this.operations = const [],
|
|
this.hasReachedMax = false,
|
|
this.errorMessage,
|
|
this.query = '',
|
|
this.dateRange,
|
|
});
|
|
|
|
OperationListState copyWith({
|
|
OperationListStatus? status,
|
|
List<OperationModel>? operations,
|
|
bool? hasReachedMax,
|
|
String? errorMessage,
|
|
String? query,
|
|
DateTimeRange? dateRange,
|
|
}) {
|
|
return OperationListState(
|
|
status: status ?? this.status,
|
|
operations: operations ?? this.operations,
|
|
hasReachedMax: hasReachedMax ?? this.hasReachedMax,
|
|
errorMessage: errorMessage,
|
|
query: query ?? this.query,
|
|
dateRange: dateRange ?? this.dateRange,
|
|
);
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
status,
|
|
operations,
|
|
hasReachedMax,
|
|
errorMessage,
|
|
query,
|
|
dateRange,
|
|
];
|
|
}
|