jonataslaw / get_server

A backend server that makes it possible to program with Flutter syntax and reuse existing code
Apache License 2.0
476 stars 42 forks source link

CRUD example required #84

Open julianoventola opened 2 years ago

julianoventola commented 2 years ago

I tried to build a simples "to-do" API, but i am struggling a lot about how to handle the async context in routes that are waiting a Widget as return. How am i supposed to use it?

Also, i tried to use the "example" of get_server tab and it needs some updates.

Great work tho!

image

jonataslaw commented 2 years ago

The ways of managing asynchronous states works in theory the same way Flutter works. For example, you can use the Visibility Widget to not display the response until the data is available: Ex: https://github.com/jonataslaw/get_server/blob/master/example/lib/pages/visibility/visibility.dart

You can also use the FutureBuilder widget, like in Flutter, or use GetX's built-in state manager to make updates. Remember this is for http where you can only deliver one request, for two-way communication you need to use websockets. I'll update the documentation and example over the weekend, I'm a little out of time right now