JSON:API adapter for Flutter Data.
Add flutter_data_json_api_adapter to your pubspec.yaml and then import the adapter into your models.
Example:
@JsonSerializable()
@DataRepository([JSONAPIAdapter, MyJSONAPIAdapter])
classUserwithDataModel<User> {
@overridefinalint id;
finalString name;
User({this.id, this.name});
}
mixinMyJSONAPIAdapteronRemoteAdapter<User> {
@overrideStringget 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
See LICENSE.