2021-05-25 21:53:54 +00:00
|
|
|
part of 'jobs_cubit.dart';
|
|
|
|
|
2021-07-29 05:24:42 +00:00
|
|
|
abstract class JobsState extends Equatable {
|
|
|
|
@override
|
|
|
|
List<Object?> get props => [];
|
|
|
|
}
|
2021-05-25 21:53:54 +00:00
|
|
|
|
2021-07-29 05:24:42 +00:00
|
|
|
class JobsStateLoading extends JobsState {}
|
2021-05-25 21:53:54 +00:00
|
|
|
|
2021-07-29 05:24:42 +00:00
|
|
|
class JobsStateEmpty extends JobsState {}
|
2021-05-25 21:53:54 +00:00
|
|
|
|
2021-07-29 05:24:42 +00:00
|
|
|
class JobsStateWithJobs extends JobsState {
|
|
|
|
JobsStateWithJobs(this.jobList);
|
|
|
|
final List<Job> jobList;
|
2021-05-25 21:53:54 +00:00
|
|
|
|
|
|
|
JobsState removeById(String id) {
|
|
|
|
var newJobsList = jobList.where((element) => element.id != id).toList();
|
2021-07-29 05:24:42 +00:00
|
|
|
|
|
|
|
if (newJobsList.isEmpty) {
|
|
|
|
return JobsStateEmpty();
|
|
|
|
}
|
|
|
|
return JobsStateWithJobs(newJobsList);
|
2021-05-25 21:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2021-07-29 05:24:42 +00:00
|
|
|
List<Object?> get props => jobList;
|
2021-05-25 21:53:54 +00:00
|
|
|
}
|