mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-13 20:23:16 +00:00
27 lines
671 B
Dart
27 lines
671 B
Dart
|
part of 'client_jobs_cubit.dart';
|
||
|
|
||
|
abstract class JobsState extends Equatable {
|
||
|
@override
|
||
|
List<Object?> get props => [];
|
||
|
}
|
||
|
|
||
|
class JobsStateLoading extends JobsState {}
|
||
|
|
||
|
class JobsStateEmpty extends JobsState {}
|
||
|
|
||
|
class JobsStateWithJobs extends JobsState {
|
||
|
JobsStateWithJobs(this.clientJobList);
|
||
|
final List<ClientJob> clientJobList;
|
||
|
JobsState removeById(final String id) {
|
||
|
final List<ClientJob> newJobsList =
|
||
|
clientJobList.where((final element) => element.id != id).toList();
|
||
|
if (newJobsList.isEmpty) {
|
||
|
return JobsStateEmpty();
|
||
|
}
|
||
|
return JobsStateWithJobs(newJobsList);
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
List<Object?> get props => clientJobList;
|
||
|
}
|