Provider koji salje get req na API i tu upisujemo link od API-a

PHOTO EMBED

Wed May 18 2022 09:51:56 GMT+0000 (UTC)

Saved by @Vesko_devv #dart

class UserProvider extends GetConnect {
  Future<List<dynamic>> getUser() async {
    final response = await get("https://randomuser.me/api/?results=10");
    if (response.status.hasError) {
      return Future.error(response.statusText);
    } else {
      return response.body['results'];
    }
  }
}
content_copyCOPY

Da bi kreirali automatski model od json-a kojeg uzimamo kucamo komandu ### get generate model on home from https://randomuser.me/api/?results=10 kreirace model na home page-u od linka