client library Null safety

Provides JSON:API client for Flutter, browsers and vm.

There are two clients implementation provided by this library.

The firs one, Client, is the most flexible but low level. It operates generic Request and Response objects and performs basic operations such as JSON conversion and error handling. It is agnostic to the document structure and accepts any target URIs.

By default, the DisposableHandler is used which internally creates a new instance of Dart built-in HTTP client for each request and then disposes it. If you want more control of the underlying http client, one option can be to use the PersistentHandler. To use another HTTP client, such as dio implement your own wrapper.

The codec performs JSON encoding/decoding. The default implementation uses native dart:convert. Provide your own PayloadCodec if you need fine-grained control over JSON conversion.

The RoutingClient is a wrapper over Client containing methods representing the most common use cases of resource fetching and manipulation. It can conveniently construct and parse JSON:API documents and URIs. The RoutingClient should be your default choice.


A basic JSON:API client.
This HTTP handler creates a new instance of the Client for every request end disposes the client after the request completes.
Handler which relies on the built-in Dart HTTP client. It is the developer's responsibility to instantiate the client and call close() on it in the end pf the application lifecycle.
A related resource response.
RelationshipFetched<R extends Relationship>
A response to a relationship fetch request.
RelationshipUpdated<R extends Relationship>
A response to a relationship request.
A generic JSON:API request.
A response to a new resource creation request. This is always a "201 Created" response.
A response to fetch a primary resource request
A routing JSON:API client

Exceptions / Errors

Thrown when the server returns a non-successful response.