Snippets

Send HTTP Get Request in Flutter

Posted by I. B. Gd Pramana A. Putra, 26 Aug 22, last updated 26 Aug 22

import 'dart:convert';
import 'package:http/http.dart' as http;

void main() async {
    http.Response response = await getUsers();
    
    print(response.body);
}

Future<http.Response> getUsers() {
    return http.get(
        Uri.parse('https://reqres.in/api/users');
    );
}

I love sharing code snippets as most of the time, a quick code example is what we're looking for instead of long-written articles. If you think my code snippets are helpful and save you a lot of time, please consider buying me a cup of coffee :)

Support me via · paypal · buymeacoffee · ko-fi · trakteer
Contributed Snippets
Answer & Responses
    No comments yet

Wanna write a response?

You have to login before write a comment to this post.