http_client 0.1.0+1 copy "http_client: ^0.1.0+1" to clipboard
http_client: ^0.1.0+1 copied to clipboard

outdatedDart 1 only

Wrapper of the http package to provide a single interface for both browser and console clients, until it will support it out of the box.

HTTP client wrapper #

Wrapper of the http package to provide a single interface for both browser and console clients, until it will support it out of the box.

Usage: #

To develop your platform-agnostic library, use only the base import:

import 'package:http_client/http_client.dart';

class MyServiceClient {
  final BaseClient httpClient;
  MyServiceClient(this.httpClient);
}

For console apps:

import 'package:http_client/console.dart';
import 'package:http_client/http_client.dart';

main() {
  BaseClient client = newHttpClient();
  // use the client, eg.:
  // new MyServiceClient(client)
}

For browser use, only change the first import:

import 'package:http_client/browser.dart';
import 'package:http_client/http_client.dart';

main() {
  BaseClient client = newHttpClient();
  // use the client, eg.:
  // new MyServiceClient(client)
}
15
likes
0
pub points
88%
popularity

Publisher

verified publisheragilord.com

Wrapper of the http package to provide a single interface for both browser and console clients, until it will support it out of the box.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http

More

Packages that depend on http_client