I have this bloc_test in my Flutter code
blocTest<ProjectsBloc, ProjectsState>(
'emits [ProjectsState.loading(), ProjectsState.succes([])] with empty projects',
build: () => projectsBloc,
act: (bloc) => bloc.add(const ProjectsEvent.fetchProjects()),
wait: const Duration(milliseconds: 2000),
expect: () => [
const ProjectsState.loading(),
const ProjectsState.succes([]),
],
);
If I do not use the wait options the test will fail because the act event will take 1 second. Using wait I can make sure that we wait long enough so the test will be ok. This seems a bit iffy.. so my question is, is there a way to remove the wait option and simply await until the given event is handled?