iws_http 1.1.0 copy "iws_http: ^1.1.0" to clipboard
iws_http: ^1.1.0 copied to clipboard

Library to facilitate http requests with error handling for Rest API requests.

example/main.dart

import 'dart:convert' as convert;

import 'package:iws_http/iws_http.dart';
import 'dart:developer' as developer;

void main() async {
  final iwsHttp =
      IwsHttp.setup(authority: 'googleapis.com', basePath: 'books/v1/');

  try {
    var response =
        await iwsHttp.get(path: 'volumes', queryParameters: {'q': '{http}'});
    var jsonResponse =
        convert.jsonDecode(response.body) as Map<String, dynamic>;
    var itemCount = jsonResponse['totalItems'];

    developer.log('Number of books about http: $itemCount.');
  } on ApiException catch (e) {
    developer.log('Request failed with status: ${e.httpCode}.');
  }
}
0
likes
160
points
35
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Library to facilitate http requests with error handling for Rest API requests.

Homepage

License

MIT (license)

Dependencies

flutter, http

More

Packages that depend on iws_http