Substituindo o then por await incluindo os catchErro acontece o erro =unhandled exception: invalid argument(s) (onerror): the error handler of future.catcherror must return a value of the future's type. Versão do flutter 2.5.1
Metodo abaixo criado no curso de "Comunicação HTTP: Flutter com web API"
Future _send(Transaction transactionCreated, String password, BuildContext context) async { final Transaction transaction = await _client.save(transactionCreated, password).catchError((e) { _showFailureMessage(context, message: e.message); }, test: (e) => e is HttpException).catchError((e) { _showFailureMessage(context, message: 'timeout submittring the transaction'); }, test: (e) => e is TimeoutException).catchError((e) { _showFailureMessage(context); }, test: (e) => e is Exception);
return transaction;
}
Qual seria a solução para corrigir esse erro?