Alterando a dúvida, como eu posso tratar esse erro, que eu descobri que acontece quando cai o servidor? Dá erro de timeout connection e não adiciona nenhum journal.
Erros:
E/flutter (14220): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Connection timed out
This function has a nullable return type of 'Route?', but ends without returning a value. Try adding a return statement, or if no value is ever returned, try changing the return type to 'void'.
onGenerateRoute: (settings) { if (settings.name == 'add-journal') { final Journal journal = settings.arguments as Journal; return MaterialPageRoute( builder: (context) { return AddJournalScreen(journal: journal); }, ); } }, Código completo: https://github.com/giseletoledo/flutter_webapi_first_course/tree/main/lib