http_platforms 1.0.3 copy "http_platforms: ^1.0.3" to clipboard
http_platforms: ^1.0.3 copied to clipboard

A versatile HTTP networking package for Dart/Flutter that supports Web, Android, and iOS. Simplify API requests with cross-platform compatibility.

example/http_platforms_example.dart

import 'dart:convert';

import 'package:http_platforms/http_platforms.dart';

void main() async {
  var url =
      Uri.https('www.googleapis.com', '/books/v1/volumes', {'q': '{http}'});

  // Await the http get response, then decode the json-formatted response.
  var response = await HttpPlatform.get(url: url.origin);
  if (response.statusCode == 200) {
    var jsonResponse = jsonDecode(response.body) as Map<String, dynamic>;
    var itemCount = jsonResponse['totalItems'];
    print('Number of books about http: $itemCount.');
  } else {
    print('Request failed with status: ${response.statusCode}.');
  }
}
1
likes
0
points
58
downloads

Publisher

unverified uploader

Weekly Downloads

A versatile HTTP networking package for Dart/Flutter that supports Web, Android, and iOS. Simplify API requests with cross-platform compatibility.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http, http_parser, mime

More

Packages that depend on http_platforms