cupertino_http 3.0.0 copy "cupertino_http: ^3.0.0" to clipboard
cupertino_http: ^3.0.0 copied to clipboard

A macOS/iOS Flutter plugin that provides access to the Foundation URL Loading System.

example/example.dart

import 'dart:convert' as convert;

import 'package:cupertino_http/cupertino_http.dart';

void main(List<String> arguments) async {
  // This example uses the Google Books API to search for books about http.
  // https://developers.google.com/books/docs/overview

  // For a complete example of using `package:cupertino_http` in a Flutter
  // application, see:
  // https://github.com/dart-lang/http/tree/master/pkgs/flutter_http_example
  final client = CupertinoClient.defaultSessionConfiguration();
  final url = Uri.https('www.googleapis.com', '/books/v1/volumes', {
    'q': '{http}',
  });

  // Await the http get response, then decode the json-formatted response.
  final response = await client.get(url);
  if (response.statusCode == 200) {
    var jsonResponse =
        convert.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}.');
  }
  client.close();
}
78
likes
0
points
187k
downloads

Publisher

verified publisherdart.dev

Weekly Downloads

A macOS/iOS Flutter plugin that provides access to the Foundation URL Loading System.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

async, ffi, hooks, http, http_profile, logging, native_toolchain_c, objective_c, web_socket

More

Packages that depend on cupertino_http