Skip to content
pubscout

openapi_generator_cli

7.0.0, released 6 months ago by devappliance.com

A Dart CLI wrapper around openapi-generator to generate API client code.

WASM-ready
$ flutter pub add openapi_generator_cli
Source repository

What it does

Wraps the openapi-generator tool to automatically create API client libraries, server stubs, documentation, and configuration from an OpenAPI Specification.

AI-written summary of version 7.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to generate Dart or Flutter API client SDKs from an OpenAPI specification.
  • You want to use a CLI tool to automate API client code generation.

Skip it when

  • You prefer writing your network requests manually or using a runtime client like dio or http.
  • You do not use an OpenAPI specification for your backend.

Strengths

  • Automates the creation of complex API client libraries from OpenAPI specs.
  • Provides a Dart CLI wrapper around the established openapi-generator tool.

Weaknesses

  • Requires proper PATH configuration for global pub executables.
  • Generated code can sometimes require dependency overrides for version conflicts.

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
4

Install globally via dart pub global activate openapi_generator_cli and ensure the pub-cache/bin directory is in your PATH.

dart pub global activate openapi_generator_cli
openapi-generator generate -i http://127.0.0.1:8111/v3/api-docs -g dart

Alternatives

Packages that do the same job and could replace openapi_generator_cli.

  • retrofit

    If you prefer writing abstract Dart interfaces with annotations to generate REST client code using dio instead of generating from an OpenAPI spec file.

Works with

Packages commonly used together with openapi_generator_cli: ones it builds on, ones built on it, and its own family.