openapi_flutter_gen library
A high-performance OpenAPI-to-Dart/Flutter code generator.
Produces immutable models, sealed exhaustive response types, typed auth
interceptors, pagination, and Isolate-based JSON deserialization — all
with zero build_runner dependency in generated code.
Supports OAS 3.x (JSON/YAML) and Swagger 2.0 specs.
Classes
- CodeGenerator
- Generates Dart code from an IrApiDocument. Produces models, API services, result types, and support files (auth interceptors, pagination, etc.) into outputDir.
- IrApiDocument
- The top-level OpenAPI document.
- IrApiInfo
- API metadata (title, version, description).
- IrEnumSchema
- An enum schema with a list of values.
- IrEnumValue
- A single enum value with a name and optional JSON value.
- IrListSchema
- An array/list schema.
- IrMapSchema
- A map/dictionary schema.
- IrMediaType
- A media type in a request or response body.
- IrObjectSchema
- An object schema with named properties.
- IrOperation
- An API operation (HTTP method on a path).
- IrParameter
- A parameter of an operation (path, query, header, or cookie).
- IrPrimitiveSchema
- A primitive/leaf schema (string, integer, number, boolean, etc.).
- IrProperty
- A property of an object schema.
- IrRefSchema
- A reference to another schema by name.
- IrRequestBody
- A request body definition.
- IrResponse
- An HTTP response definition.
- IrResponseHeader
- A header in an HTTP response.
- IrSchema
- Abstract base for all intermediate representation schemas.
- IrSecurityScheme
- A security scheme definition.
- IrServer
- A server definition.
- IrServerVariable
- A server variable with default and optional enum values.
- IrUnionSchema
- A oneOf / anyOf union schema with discriminated variants.
- IrUnionVariant
- A variant within a IrUnionSchema.
- OpenApiSpecParser
-
Parses an OpenAPI 3.x document into an IrApiDocument.
Supports JSON and YAML (pre-parsed to Map), handles
$refresolution, inline schema extraction, oneOf/anyOf/allOf unions, and Swagger 2.0 (via SwaggerNormalizer). - SwaggerNormalizer
- Normalizes Swagger 2.0 / OpenAPI 2.x documents into OpenAPI 3.x-compatible JSON so the main OpenApiSpecParser can process them without any awareness of the legacy format.
Enums
- IrEncodingStyle
- Encoding style for a parameter.
- IrParameterLocation
- Where a parameter is located in the HTTP request.
- IrPrimitiveType
- The supported primitive types.
Functions
-
getBool(
Map< String, dynamic> map, String key) → bool? -
Safely gets a bool value from
mapbykey. -
getDouble(
Map< String, dynamic> map, String key) → double? -
Safely gets a double value from
mapbykey. -
getInt(
Map< String, dynamic> map, String key) → int? -
Safely gets an int value from
mapbykey. -
getList(
Map< String, dynamic> map, String key) → List? -
Safely gets a List value from
mapbykey. -
getMap(
Map< String, dynamic> map, String key) → Map<String, dynamic> ? -
Safely gets a Map value from
mapbykey. -
getString(
Map< String, dynamic> map, String key) → String? -
Safely gets a String value from
mapbykey. -
loadSpec(
String path) → Future< Map< String, dynamic> > - Loads an OpenAPI spec from a local file path (JSON or YAML).
-
loadSpecFromUrl(
String url) → Future< Map< String, dynamic> > - Loads an OpenAPI spec from a remote URL (JSON or YAML).