retrofit_craft 0.5.0
retrofit_craft: ^0.5.0 copied to clipboard
Annotations to declare a grouped, versioned retrofit API client aggregator for the riverpod_craft / craft_runner ecosystem.
0.5.0 #
- Synchronized release across
riverpod_craft_plugin,craft_runner,retrofit_craft, andretrofit_craft_plugin. No functional changes vs 0.4.0 — version bumped to keep the four packages in lock-step going forward.
0.4.0 #
Initial pub.dev release. Versioned in lock-step with retrofit_craft_plugin,
craft_runner, and riverpod_craft_plugin.
Surface #
-
class Api<E extends Object, V extends Object>— generic annotation applied alongside retrofit's@RestApi()to mark a class for inclusion in the generatedAppApi.entryandversionare typedE?/V?, so every call site gets full type safety and Dart 3.6+ dot-shorthand:@Api(entry: .identity, version: .v1) @RestApi() abstract class AuthApi { ... } -
Each project declares one concrete subclass to bind its own enums:
class Api extends rc.Api<Entry, Version> { const Api({super.entry, super.version}); }
Conventions consumed by retrofit_craft_plugin #
Entry(any enum / class) is expected to expose aString baseUrlso the generator can emitEntry.<name>.baseUrlinto every retrofit ctor call.Version(any enum / class) optionally exposes afinal String path;field; when present, the generator appendsVersion.<name>.pathto the baseUrl so the version segment lives in one place. Method@POST/@GETpaths can then drop their version prefix.@Api()with no args picks updefault_entry/default_versionfromriverpod_craft.yaml.