vstate 0.0.4
SDKflutter
Platformandroidioswindowslinuxmacosweb
library that provides functionality for generating documentation for API requests.
vstate vstate is a Dart library that provides functionality for generating documentation for API requests. The library includes a generator that can parse annotated classes and functions and generate Markdown files that describe their associated API requests.
Usage To use vstate, import the library and use the RequestApi annotation to annotate functions that correspond to API requests:
add
dependencies:
flutter:
sdk: flutter
vstate:
dev_dependencies:
flutter_test:
sdk: flutter
build_runner:
import 'package:vstate/vstate.dart';
class XRepository {
// ...
@RequestApi(
endpoint: '/api/v1/users',
methodType: 'GET',
requestType: '',
responseType: 'List<User>',
)
Future<void> FatchUsers(){
// ...
}
}
flutter pub run build_runner build
When you run the docGeneratorBuilder builder on your code, it will generate a Markdown file with information md
Class UserApiClient
| Endpoint | Method Type | Request Type | Response Type |
|---|---|---|---|
/api/v1/users | GET | List<User> |
Request Body
| Field | Type | Required |
|---|---|---|
String ('id') | int | ✅ |
String ('name') | String | ✅ |
Function incrementCounter
| Endpoint | Method Type | Request Type | Response Type |
|---|---|---|---|
/func3 | GET | func3 | func3 |