json_api 4.0.0-dev.3 json_api: ^4.0.0-dev.3 copied to clipboard
JSON:API Client for Flutter, Web and VM. Supports JSON:API v1.0 (http://jsonapi.org)
JSON:API for Dart/Flutter #
JSON:API is a specification for building APIs in JSON.
This package consists of several libraries:
- The Client library to make requests to JSON:API servers
- The Server library which is still under development
- The Document library model for resources, relationships, identifiers, etc
- The Query library to build and parse the query parameters (pagination, sorting, etc)
- The URI Design library to build and match URIs for resources, collections, and relationships
- The HTTP library to interact with Dart's native HTTP client and server
Document model #
This part assumes that you have a basic understanding of the JSON:API standard. If not, please read the JSON:API spec.
The main concept of JSON:API model is the Resource. Resources are passed between the client and the server in the
form of a Document. A resource has its type
, id
, and a map of attributes
. Resources refer to other resources
with the Identifier objects which contain a type
and id
of the resource being referred.
Relationship between resources may be either toOne
(maps to a single identifier)
or toMany
(maps to a list of identifiers).
Client #
JsonApiClient is an implementation of the JSON:API client supporting all features of the JSON:API standard:
- fetching resources and collections (both primary and related)
- creating resources
- deleting resources
- updating resource attributes and relationships
- direct modification of relationships (both to-one and to-many)
- async processing