Show error toast for 5xx error

This commit is contained in:
hunteraraujo
2023-10-20 00:20:46 -07:00
parent 27ff99a9a5
commit 2187f66149

View File

@@ -144,6 +144,20 @@ class _ChatViewState extends State<ChatView> {
"linear-gradient(to right, #dc1c13, #dc1c13)",
textColor: Colors.white,
fontSize: 16.0);
} else if (response is http.Response &&
response.statusCode >= 500 &&
response.statusCode < 600) {
Fluttertoast.showToast(
msg: "500 error: Something went wrong",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.TOP,
timeInSecForIosWeb: 5,
backgroundColor: Colors.red,
webPosition: "center",
webBgColor:
"linear-gradient(to right, #dc1c13, #dc1c13)",
textColor: Colors.white,
fontSize: 16.0);
}
}
},