Skip to content
pubscout

openapi_generator

7.0.0, released 6 months ago by devappliance.com

Generator for OpenAPI client SDKs in Dart and Flutter projects.

WASM-ready
$ flutter pub add openapi_generator
Source repository

What it does

Generates API client SDKs directly from local or remote OpenAPI specifications using build_runner. It acts as a wrapper around the Java-based OpenAPI Generator CLI to integrate seamlessly into Dart and Flutter development workflows.

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

Use it when

  • You have an OpenAPI specification (JSON or YAML) and need to generate a matching Dart client SDK.
  • You want automated synchronization of your API client when the backend OpenAPI spec updates.

Skip it when

  • You do not have Java installed on your system (Java 8 or higher is required).
  • You prefer writing your REST API clients manually.

Strengths

  • Automates client SDK generation from standard OpenAPI specs.
  • Supports both local file and remote URL specifications with caching.

Weaknesses

  • Requires Java to be installed and available in the system PATH.
  • Issues with generated code often need to be addressed in the base OpenApi library rather than this wrapper.

Setup

Kind
Pure Dart
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
11

Requires Java (version 8 or higher) installed in your system PATH. Add openapi_generator_annotations to dependencies and openapi_generator to dev_dependencies, then run build_runner.

@Openapi(
  additionalProperties: DioProperties(pubName: 'petstore_api', pubAuthor: 'Johnny Depp'),
  inputSpec: RemoteSpec(path: 'https://petstore3.swagger.io/api/v3/openapi.json'),
  generatorName: Generator.dio,
  outputDirectory: 'api/petstore_api',
)
class Example {}

Alternatives

Packages that do the same job and could replace openapi_generator.

Works with

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