rest_client 1.0.3

  • Readme
  • Changelog
  • Installing
  • 76

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...

[1.0.3] - June 11th, 2020 #

  • Deprecated internal Jsonable class in favor of the JsonClass package's version

[1.0.2] - May 6th, 2020 #

  • Minor fix to parseDouble

[1.0.1] - April 16th, 2020 #

  • Updated project metadata

[1.0.0] - April 12th, 2020 #

  • Initial release

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  rest_client: ^1.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:rest_client/rest_client.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
60
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and rest_client.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
http ^0.12.0+4 0.12.1
intl ^0.16.1 0.16.1
json_class ^1.0.1 1.0.3
logging ^0.11.4 0.11.4
meta ^1.1.8 1.1.8
uuid ^2.0.4 2.2.0
Transitive dependencies
charcode 1.1.3
collection 1.14.13
convert 2.1.1
crypto 2.1.5
http_parser 3.1.4
path 1.7.0
pedantic 1.9.0 1.9.1
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0
Dev dependencies
test any
test_coverage any