Estou com o mesmo problema postado pela Natalie há alguns meses, mas nenhuma das soluções funcionou.
Ao colocar "?" em Future<Transaction?>, aparece o erro:
A value of type 'Transaction?' can't be assigned to a variable of type 'Transaction' because 'Transaction?' is nullable and 'Transaction' isn't.
- 'Transaction' is from 'package:projetos2/models/transaction.dart' ('lib/models/transaction.dart').
await _webClient.save(transactionCreated, password).catchError((e) {
^
Usando a solução do Fábio, acontece outro erro:
A non-null value must be returned since the return type 'Transaction' doesn't allow null.
- 'Transaction' is from 'package:projetos2/models/transaction.dart' ('lib/models/transaction.dart').
Future<Transaction> save(Transaction transaction, String password) async {
Como posso corrigir?