notes
This commit is contained in:
39
lib/features/notes/blocs/notes_state.dart
Normal file
39
lib/features/notes/blocs/notes_state.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user