http_requests 3.2.0 http_requests: ^3.2.0 copied to clipboard
HTTP Requests Package is inspired by the `Python Requests Module`, which is used to make HTTP requests and get responses. You can use it in your `Rest API`.
import 'package:http_requests/http_requests.dart';
void main() async {
// Get Method
HttpResponse r = await HttpRequests.get("https://www.google.in");
print(r.status);
// Post Method With Headers And Data
Map<String, String> header = {
'Host': 'www.google.in',
'User-Agent':
'Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0',
'Accept': 'text/html',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Connection': 'keep-alive'
};
Map<String, String> query = {"name": "sidhu patil"};
HttpResponse req = await HttpRequests.post("https://www.google.in",
headers: header, data: query);
print(req.response);
}