How do I correctly initialize my Either
object in the following code?
class JobListState extends Equatable {
const JobListState({
this.status = JobListStatus.initial,
this.jobListSections = Right([]),
this.filter,
});
final JobListStatus status;
final Either<Failure, List<JobListViewmodel?>> jobListSections;
final JobListFilter? filter;
A very similar question was answered 1,5 years ago, but this results in the error The default value of an optional parameter must be constant.
And I guess, if I declare this.jobListSections = const Right([])
, I can no longer assign left.
I am assigning the initial value to create the initial state for Bloc.