0 purchases
vstate
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:
copied to clipboard
import 'package:vstate/vstate.dart';
copied to clipboard
class XRepository {
// ...
@RequestApi(
endpoint: '/api/v1/users',
methodType: 'GET',
requestType: '',
responseType: 'List<User>',
)
Future<void> FatchUsers(){
// ...
}
}
copied to clipboard
flutter pub run build_runner build
copied to clipboard
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.