How to fix this kind of errors when using then
?
void handleSubmitWrapper() {
final future = handleSubmit();
future.then(context.loaderOverlay.hide()); // error
}
Future<void> handleSubmit() async {
...
}
This expression has a type of 'void' so its value can't be used. Try checking to see if you're using the correct API; there might be a function or call that returns void you didn't expect. Also check type parameters and variables which might also be void.dart
You must provide an anonymous function in your case, which has type FutureOr Function(void).
future.then((void _) => context.loaderOverlay.hide());