Displaying Server-Side validation error in Input screen.

62 views
Skip to first unread message

Sankaran Kozhissery

unread,
Sep 2, 2019, 11:41:01 PM9/2/19
to Flutter Development (flutter-dev)
I am newbie to flutter. I am trying to figure out on how to display error message returned from the server (REST) adjacent to the input elements.

As an example, 

Let's say if there is a login screen and user enters credentials and clicks 'Login' button. The UI needs to move to flash screen till it gets response from the server. Once it receives the response from the server, it would redirect to different screens based on the response. In case of error it should display the login screen back with error information next to the input element. In case of success scenario, it needs to be redirected to a pre-defined home page.

Please let me know how to handle this scenario. I might be wrong in overall thinking, probably there would be a better way to handle things. Please explain.

Thanks and Regards
Sankaran

Batuhan Demircan

unread,
Sep 3, 2019, 7:05:15 AM9/3/19
to Flutter Development (flutter-dev)
If you are using API for this login scenario, use your API's response codes for switch case blocks and handle the response. If you are connected to database directly, you can use try catch blocks to handle login request.

3 Eylül 2019 Salı 06:41:01 UTC+3 tarihinde Sankaran Kozhissery yazdı:

Sankaran Kozhissery

unread,
Sep 3, 2019, 8:16:28 AM9/3/19
to Flutter Development (flutter-dev)
Thank you for your response. I intent to ask how do we handle the REST Api messages the way we handle synchronous processing. Usually material design suggest to show the error message next to the input. Likewise do we have any option to display error messages which returned from the REST Api?
Reply all
Reply to author
Forward
0 new messages