ApiController class
The ApiController class is responsible for managing API routes and generating
OpenAPI documentation for the API.
This controller extends the Controller and includes functionality for
configuring API routes, generating Swagger UI documentation, and handling
security settings.
Example usage:
ApiController(
rq,
router: myRouter,
title: 'My API',
security: 'apiKey',
);
- Inheritance
-
- Object
- Controller
- ApiController
Constructors
- ApiController({required FinchApp app, required String title, String security = 'apiKey'})
-
Constructs a ApiController with the given request
rq, router, title, and optional security scheme.
Properties
- app ↔ FinchApp
-
A list of functions that return a list of FinchRoute objects based on the
incoming Request
rq.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- rq → Request
-
Gets the current WebRequest from the request context
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- security ↔ String
-
The security scheme used for the API. Defaults to
'apiKey'.getter/setter pair - title ↔ String
-
The title of the API, used in generated documentation.
getter/setter pair
Methods
-
index(
{bool showPublic = false}) → Future< String> -
Generates and returns OpenAPI documentation as a JSON string.
override
-
indexPublic(
) → Future< String> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
swagger(
String docUrl, {String swaggerUIPath = '/swagger', bool showPublic = false}) → Future< String> - Renders the Swagger UI for the API documentation.
-
toString(
{bool short = false}) → String -
Returns a string representation of the controller.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited