swagger_to_dart 0.0.7 swagger_to_dart: ^0.0.7 copied to clipboard
Convert Swagger to Dart using freezed and retrofit support only 3.1.0 openApi
Swagger to Dart #
-
Add dependencies to
pubspec.yaml
file: #
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
freezed
withretrofit
use build.yaml file with this content: #
global_options:
freezed:
runs_before:
- json_serializable
json_serializable:
runs_before:
- retrofit_generator
-
Run code generation with
build_runner
forjson_seializable
(freezed
) andretrofit
with command: #
dart run build_runner build
-
Clients and models are generated! #