finch_route library

Classes

ApiBodyField<T>
Creates an instance of ApiParameter. name - The name of the parameter. def - Optional default value for the parameter. description - Optional description of the parameter. isRequired - Indicates whether the parameter is required.
ApiController
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:
ApiDoc
Represents the documentation for an API endpoint in OpenAPI/Swagger format.
ApiParameter<T>
Represents a parameter used in an API request. T - The Dart type of the parameter.
ApiResponse<T>
Represents a field in the body of an API request. T - The Dart type of the body field.
Asset
Represents an asset (like JS or CSS) in the web application. The Asset class is used to manage individual assets, including their path, type, and cache settings. It provides methods for constructing the correct URL for the asset, considering cache policies.
AssetManager
Manages the assets for a web request, including JavaScript, CSS, and data. The AssetManager class is responsible for handling various assets (like JS and CSS files) and the data to be included in a web response. It provides methods for adding assets, managing cache settings, and generating the necessary HTML for including assets in the frontend.
AuthController<T>
The AuthController is an abstract class that defines authentication and authorization methods for a web application. This controller handles common tasks like login, registration, authentication checks, and user session management. It extends the Controller and provides methods that can be overridden to customize authentication logic. The type parameter T represents the user model or object being used in the authentication process.
Authorization
Represents an authorization scheme used for authentication. The Authorization class is designed to handle different types of authorization schemes. It provides methods to parse authorization headers and extract credentials based on the specified authentication type.
Context
Controller
Base controller class for handling HTTP requests in the web application. Controller serves as the foundation for all request handlers in the framework. It provides access to the current request context and implements the RouteRepos interface for standardized request handling. Controllers are typically used to organize related request handling logic and can be associated with routes to process incoming HTTP requests. the rq getter, is RequestContext.rq to access the current WebRequest. This design leverages the Zone-based Context system for thread-safe request handling.
FinchRoute
Defines a web route configuration for HTTP request handling in the application. The FinchRoute class represents a single route definition that specifies how incoming HTTP requests should be matched and handled. It supports advanced routing features including pattern matching, HTTP method filtering, host/port restrictions, nested routing, authentication, and authorization. Key features:
FinchService
Represents a basic service in the application. The FinchService class is a base class for services that provide various functionalities in the application. It includes a method for generating a string representation of the service.
IncludeJsController
A controller responsible for injecting JavaScript for client-side operations. This controller generates a JavaScript snippet that contains global configuration and translation functions. The generated JavaScript can be used on the client-side to handle localization and dynamic URL generation.
Methods
A utility class that provides constants and predefined lists for various HTTP request methods. This class includes constants for common HTTP methods and provides convenience lists for frequently used method combinations. It is useful for standardizing and managing HTTP method strings throughout an application.
Permissions
The Permissions class provides a set of predefined constants representing user permission levels. These constants can be used to check and assign different permission levels within the authentication logic. You can define custom permission levels by extending this class.
Request
Handles HTTP request processing and response generation for the Finch framework. Request is the core class responsible for processing incoming HTTP requests and generating appropriate responses. It provides a comprehensive API for: Request Processing:
Route
A comprehensive route management and request processing system for web applications. The Route class serves as the core routing engine that processes incoming HTTP requests, matches them against defined route patterns, and handles the appropriate response rendering. It supports features like nested routing, URL parameters, authentication, permission checks, static file serving, and widget rendering. Key features:
RouteRepos
Interface defining the contract for route request handlers. RouteRepos establishes a standardized interface that all route handlers must implement. It serves as a contract ensuring that request handling components provide consistent entry points for processing HTTP requests. The interface is designed to support the routing system's n implementation details. This abstraction enables the framew Implementations should:
SSE
SwaggerController

Enums

AssetCache
Enum representing the cache policy for assets.
AssetType
Enum representing the type of asset (JS, CSS, or none).
AuthType
Enumeration representing different types of authorization schemes.
ParamIn
Enumeration representing the possible locations for a parameter in an API request.