Files
flux/lib/features/notes/blocs/notes_state.dart
2026-05-21 14:43:47 +02:00

40 lines
927 B
Dart

part of 'notes_bloc.dart';
enum NotesStatus { initial, loading, success, failure }
class NotesState {
final NotesStatus status;
final List<NoteModel> notes;
final String? errorMessage;
const NotesState({
this.status = NotesStatus.initial,
this.notes = const [],
this.errorMessage,
});
NotesState copyWith({
NotesStatus? status,
List<NoteModel>? notes,
String? errorMessage,
}) {
return NotesState(
status: status ?? this.status,
notes: notes ?? this.notes,
errorMessage: errorMessage ?? this.errorMessage,
);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is NotesState &&
other.status == status &&
listEquals(other.notes, notes) &&
other.errorMessage == errorMessage;
}
@override
int get hashCode => status.hashCode ^ notes.hashCode ^ errorMessage.hashCode;
}