Last updated:
0 purchases
http client
Platform-independent HTTP client #
A platform-independent HTTP client API supporting browser, console,
and curl (for SOCKS proxy). Planned platforms: Fetch API, node_io.
Usage: #
To develop your platform-agnostic library, use only the base import:
import 'package:http_client/http_client.dart' as http;
class MyServiceClient {
final http.Client httpClient;
MyServiceClient(this.httpClient);
}
copied to clipboard
For console apps:
import 'package:http_client/console.dart' as http;
main() async {
final client = http.ConsoleClient();
// use the client, eg.:
// new MyServiceClient(client)
await client.close();
}
copied to clipboard
For browser use, only change the first import:
import 'package:http_client/browser.dart' as http;
main() {
final client = http.BrowserClient();
// use the client, eg.:
// new MyServiceClient(client)
await client.close();
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.