rest_client 1.0.6+2 copy "rest_client: ^1.0.6+2" to clipboard
rest_client: ^1.0.6+2 copied to clipboard

discontinued
outdated

A Dart and Flutter based REST API client that simplifies making RESTful calls. In Flutter, the response is processed on a separate Isolate to avoid causing jank on the UI thread for large responses. [...]

rest_client #

Dart Publisher

A Dart and Flutter compatible library to simplify creating REST based API calls.

For Flutter based applications, this will offload the JSON decoding to a separate Isolate to avoid janking the UI thread on large JSON responses. For Dart Web / AngularDart based applications, this processes the JSON on the main thread because Isolates are not supported.

Using the library #

Add the repo to your Flutter pubspec.yaml file.

dependencies:
  rest_client: <<version>> 

Then run...

flutter packages get

Authorizers #

The API Client offers the following two built in authorizers.

  • BasicAuthorizer -- To authenticate against an API using the BASIC username / password security models.
  • TokenAuthorizer -- To authorize against an API using Bearer token based authorization.

Example #

import 'package:rest_client/rest_client.dart' as rc;

...

var client = rc.Client();

var request = rc.Request(
  url: 'https://google.com',
);

var response = client.execute(
  authorizor: rc.TokenAuthorizer(token: 'my_token_goes_here'),
  request: request, 
);

var body = response.body;
// do further processing here...
13
likes
20
points
2.21k
downloads

Publisher

verified publisherpeifferinnovations.com

Weekly Downloads

A Dart and Flutter based REST API client that simplifies making RESTful calls. In Flutter, the response is processed on a separate Isolate to avoid causing jank on the UI thread for large responses. In Dart Web, the response is processed on the main thread.

Repository (GitHub)

License

MIT (license)

Dependencies

http, intl, json_class, logging, meta, uuid

More

Packages that depend on rest_client