Skip to content

flutterdata/flutter_data_json_api_adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

45 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

flutter_data_json_api_adapter

JSON:API adapter for Flutter Data.

πŸ‘©πŸΎβ€πŸ’» Usage

Add flutter_data_json_api_adapter to your pubspec.yaml and then import the adapter into your models.

Example:

@JsonSerializable()
@DataRepository([JSONAPIAdapter, MyJSONAPIAdapter])
class User with DataModel<User> {
  @override
  final int id;
  final String name;
  User({this.id, this.name});
}

mixin MyJSONAPIAdapter on RemoteAdapter<User> {
  @override
  String get baseUrl => "https://my.jsonapi.server/api";

  // other customizations
}

This adapter provides default application/vnd.api+json headers.

Tests can be run with: pub run test

πŸ“ License

See LICENSE.