swagger_to_dart 1.0.0
swagger_to_dart: ^1.0.0 copied to clipboard
Convert Swagger to Dart using freezed and retrofit support only 3.1.0 openApi
Swagger to Dart #
-
Add dependencies to
pubspec.yamlfile: #
dart pub add freezed_annotation
dart pub add dev:build_runner
dart pub add dev:freezed
dart pub add json_annotation
dart pub add dev:json_serializable
dart pub add dio
dart pub add retrofit
dart pub add dev:retrofit_generator
dart pub add dev:swagger_to_dart --path=../
-
For
freezedwithretrofituse build.yaml file with this content: #
global_options:
freezed:
runs_before:
- json_serializable
json_serializable:
runs_before:
- retrofit_generator
-
Run code generation with
build_runnerforjson_seializable(freezed) andretrofitwith command: #
dart run build_runner build
-
Clients and models are generated! #