dust_http_client_annotation 0.1.0 copy "dust_http_client_annotation: ^0.1.0" to clipboard
dust_http_client_annotation: ^0.1.0 copied to clipboard

discontinuedreplaced by: dust_dart

Production-ready HttpClient annotations for the Dust code generation engine.

dust_http_client_annotation #

Annotations for Dust HTTP client generation.

Features #

  • @HttpClient() for client-level configuration
  • HTTP method annotations such as @GET() and @POST()
  • request binding annotations such as @Path(), @Query(), @Body(), and @Header()
  • content-type markers such as @FormUrlEncoded() and @MultiPart()
  • @GenerateTest() support for generated request-mapping tests

Getting started #

Install Dust by following the root README, then add this package and dio to your Dart project:

dependencies:
  dio: ^5.9.2
  dust_http_client_annotation: ^0.1.0

Usage #

import 'package:dust_http_client_annotation/dust_http_client_annotation.dart';

part 'todo_api.g.dart';

@HttpClient(
  baseUrl: 'https://api.todos.com',
  parseThread: DustParseThread.isolate,
  headers: {'x-api-version': '2026-05'},
)
@GenerateTest()
abstract interface class TodoApi {
  factory TodoApi(Dio dio, {String? baseUrl}) = _$TodoApi;

  @GET('/todos/{id}')
  Future<Todo> get(@Path() String id);

  @POST('/todos')
  Future<Todo> create(@Body() TodoCreate request);
}

Dust generates todo_api.g.dart for the concrete Dio client and test/generated/api/todo_api_test.dart when @GenerateTest() is present.

Additional information #

0
likes
140
points
24
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Production-ready HttpClient annotations for the Dust code generation engine.

Topics

#codegen #annotations #dust #http

License

MIT (license)

Dependencies

dio, meta

More

Packages that depend on dust_http_client_annotation