serverpod library

Classes

AbstractWidget
Deprecated alias for WebWidget. AbstractWidget was the base class for all widgets in the old API.
AcceptEncodingHeader
A class representing the HTTP Accept-Encoding header.
AcceptHeader
A class representing the HTTP Accept header.
AcceptLanguageHeader
A class representing the HTTP Accept-Language header.
AcceptRangesHeader
A class representing the HTTP Accept-Ranges header.
AccessControlAllowHeadersHeader
A class representing the HTTP Access-Control-Allow-Headers header.
AccessControlAllowMethodsHeader
A class representing the HTTP Access-Control-Allow-Methods header.
AccessControlAllowOriginHeader
A class representing the HTTP Access-Control-Allow-Origin header.
AccessControlExposeHeadersHeader
A class representing the HTTP Access-Control-Expose-Headers header.
AccessorState<K, R>
Holds the externalized state for ReadOnlyAccessor instances.
Adapter
An interface for adapters that bridge Relic to specific server implementations.
AdapterRequest
Base class for adapter-specific request objects.
AnyExpression<T>
A database expression that returns all rows where any of the related rows match the filtering criteria.
AsEventHandler<T extends DiagnosticEvent>
Adapter class to use an EventHandlerFunction as a DiagnosticEventHandler. Since this class inherits TypedEventHandler it can filter on event type.
AuthenticationHeader
A class representing the HTTP Authentication header.
AuthenticationInfo
Holds the id for an authenticated user and which scopes it can access. Allowed scopes are defined for each Endpoint.
AuthenticationParameter
A class representing a key-value pair parameter for authentication.
AuthorizationHeader
An abstract base class representing an HTTP Authorization header.
BadRequestMessage
A message sent when a bad request is received.
BasicAuthorizationHeader
Represents Basic authentication using a username and password.
BearerAuthorizationHeader
Represents a Bearer token for HTTP Authorization.
Bit
Represents a binary vector, where each element is either true or false.
Body
The body of a request or response.
BodyType
A body type that combines MIME type and encoding information.
CacheBustingConfig
Cache-busting for asset URLs that embed a content hash.
CacheControlHeader
A class representing the HTTP Cache-Control header.
CacheMissHandler<T extends SerializableModel>
A CacheMissHandler is used to define a function that is called when a cache miss occurs. The function is expected to return a new object that will be stored in the cache.
Cascade
A helper that calls several handlers in sequence and returns the first acceptable response.
ClearSiteDataHeader
A class representing the HTTP Clear-Site-Data header.
ClearSiteDataType
A class representing a single Clear-Site-Data type.
ClientCallOpContext
The context of a client call operation. Subclasses represent web, method, and method streaming calls.
CloseMethodStreamCommand
A message sent over a websocket connection to close a websocket stream of data to an endpoint method.
CloudStorage
The CloudStorage provides a standardized interface to store binary files in the cloud. The default implementation is to use the database for binary storage, but it can be extended to support Google Cloud, Amazon S3, or any other cloud storage service.
Column<T>
Abstract class representing a database Column. Subclassed by the different supported column types such as ColumnInt or ColumnString.
ColumnBigInt
A Column holding BigInt.
ColumnBit
A Column holding a Bit vector from pgvector.
ColumnBool
A Column holding an bool.
ColumnByteData
A Column holding ByteData.
ColumnComparable<T>
A Column whose values can be compared equal or unequal to other values. Attends full specification of default PG comparison operations: https://www.postgresql.org/docs/current/functions-comparison.html#FUNCTIONS-COMPARISON-OP-TABLE
ColumnCount
A Column holding a count of rows.
ColumnDateTime
A Column holding an DateTime. In the database it is stored as a timestamp without time zone.
ColumnDouble
A Column holding an double.
ColumnDuration
A Column holding Duration.
ColumnEnum<E extends Enum>
A Column holding an enum.
ColumnEnumExtended<E extends Enum>
Intended for internal use only
ColumnExpression<T>
Database expression for a column.
ColumnHalfVector
A Column holding a HalfVector from pgvector.
ColumnInt
A Column holding an int.
ColumnSerializable<T>
A Column holding an SerializableModel. The entity will be stored in the database as a json column.
ColumnSparseVector
A Column holding a SparseVector from pgvector.
ColumnString
A Column holding an String.
ColumnUri
A Column holding Uri.
ColumnUuid
A Column holding UuidValue.
ColumnValue<T, V>
Represents a column-value pair for database updates.
ColumnVector
A Column holding a Vector from pgvector.
ColumnVectorDistance<T>
A Column holding the result of a vector distance operation.
ConnectionHeader
A class representing the HTTP Connection header.
ConnectionHeaderType
A class representing the type of connection directives for the Connection header.
Constant
A constant Expression.
ContentDispositionHeader
A class representing the HTTP Content-Disposition header.
ContentDispositionParameter
A class representing a parameter for the Content-Disposition header.
ContentEncoding
A class representing valid content encodings.
ContentEncodingHeader
A class representing the HTTP Content-Encoding header.
ContentLanguageHeader
A class representing the HTTP Content-Language header.
ContentRangeHeader
A class representing an HTTP Content-Range header for byte ranges.
ContentSecurityPolicyDirective
A class representing a single CSP directive.
ContentSecurityPolicyHeader
A class representing the HTTP Content-Security-Policy (CSP) header.
ContextProperty<T extends Object>
Manages a piece of data associated with a specific Request.
A class representing a single cookie.
CookieHeader
A class representing the HTTP Cookie header.
CrossOriginEmbedderPolicyHeader
A class representing the HTTP Cross-Origin-Embedder-Policy header.
CrossOriginOpenerPolicyHeader
A class representing the HTTP Cross-Origin-Opener-Policy header.
CrossOriginResourcePolicyHeader
A class representing the HTTP Cross-Origin-Resource-Policy header.
Database
Provides easy access to the database in relation to the current Session.
DatabaseAccessor
Interface for accessing the database.
DatabaseCloudStorage
The DatabaseCloudStorage uses the standard Serverpod database to store binary files. It's the default CloudStorage interface of Serverpod, but you may want to replace it with a more robust service depending on your needs, especially in your production environment.
DatabaseConfig
Configuration for a Postgres database,
DatabaseResult
Database result.
DatabaseResultRow
Database result row.
DatabaseResultSchema
Database result schema.
DatabaseResultSchemaColumn
Database result schema column.
DatabaseUtil
Provides utility functions for working with the Database.
DeepCollectionEquality
Deep equality on collections.
DiagnosticEvent
Base interface for all diagnostic events.
DiagnosticEventContext
Base class for information about the context in which a DiagnosticEvent was submitted.
DiagnosticEventHandler
Base interface for DiagnosticEvent handlers.
DiagnosticEventRecord<E extends DiagnosticEvent>
A record with a submitted diagnostic event.
DigestAuthorizationHeader
Represents Digest authentication for HTTP Authorization.
DoublePathParam
A path parameter accessor that parses values as double.
DoubleQueryParam
A query parameter accessor that parses values as double.
EncodingQuality
A class representing an encoding with an optional quality value.
Endpoint
The Endpoint is an entrypoint to the Server. To add a custom Endpoint to a Server, create a subclass and place it in the endpoints directory. Code will generated that builds the corresponding client library. To add methods that can be accessed from the client, make sure that the first argument of the method is a Session parameter.
EndpointConnector
The EndpointConnector associates a name with and endpoint and its EndpointMethodConnectors.
EndpointDispatch
The EndpointDispatch is responsible for directing requests to the Server to the correct Endpoint and method. Typically, this class is overridden by an Endpoints class that is generated.
EndpointMethodConnector
The EndpointMethodConnector is a base class for connectors that connect methods their implementation.
EscapedExpression
A database expression that is escaped. This is used to escape values that are not expressions, such as strings and numbers.
ETagConditionHeader
Base class for ETag-based conditional headers (If-Match and If-None-Match).
ETagHeader
A class representing the HTTP ETag header.
EveryExpression<T>
A database expression that returns all rows where all of the related rows match the filtering criteria.
ExceptionEvent
An event that represents an exception that occurred in the server.
ExceptionHandler
A DiagnosticEventHandler that handles ExceptionEvent instances.
ExpectHeader
A class representing the HTTP Expect header.
ExperimentalApi
Experimental API for Serverpod.
ExperimentalFeatures
Setup of experimental features.
Expression<T>
A database Expression.
FallbackMiddleware
Middleware that falls back to an alternative handler when a response matches a condition.
FileInfo
Cached file information including MIME type, file stats, and ETag.
FlutterRoute
Route for serving Flutter web applications with WASM support.
ForwardedElement
Represents one forwarded-element in the Forwarded header.
ForwardedHeader
Typed representation of the Forwarded HTTP header. It's a list of ForwardedElements.
ForwardedIdentifier
Represents a node identifier in the Forwarded header, as per RFC 7239 Section 6. This can be an IP address (v4 or v6), "unknown", or an obfuscated identifier, optionally with a port.
FromHeader
A class representing the HTTP From header.
FutureCall<T extends SerializableModel>
Superclass of a FutureCall, override the invoke method to create a custom FutureCall. The call also needs to be registered with the top ServerPod object before starting the Server.
FutureCallConfig
Configuration for future call handling.
FutureCallDispatch<T>
Provides type-safe access to future calls on the server. Typically, this class is overriden by a FutureCalls class that is generated.
FutureCallManager
The FutureCallManager is responsible for managing and executing FutureCalls in the Serverpod framework. A FutureCall is a task that is scheduled to run at a specific time in the future. These tasks are persistent, meaning they are stored in the database and will still execute even if the server is restarted.
FutureCallOpContext
The context of a future call operation.
FutureCallSession
Created when a FutureCall is being made. It contains all data associated with the current call and provides easy access to the database.
HalfVector
Represents a vector of half-precision float values.
HandlerObject
An abstract base class for classes that behave like Handlers.
HeaderAccessor<T extends Object>
Flyweight accessor class for headers. It should always be const constructed.
HeaderCodec<T extends Object>
A specialized codec for HTTP headers that defines conversion between a typed value T and its string representation in headers.
Headers
Headers is a case-insensitive, unmodifiable map that stores headers.
HeadersBase
Hijack
A Result indicating that the underlying connection has been hijacked.
HnswIndexQueryOptions
Query options for the HNSW index.
HostHeader
Wanna-be RFC3986 compliant 'Host' header.
IfMatchHeader
A class representing the HTTP If-Match header.
IfNoneMatchHeader
A class representing the HTTP If-None-Match header.
IfRangeHeader
A class representing the HTTP If-Range header.
Include
The base include class, should not be used directly.
IncludeList
Defines what tables to join when querying a table.
IncludeObject
Defines what tables to join when querying a table.
InjectableIn<T>
Interface for objects that can be injected in others. This allows an object to delegate setup to another object.
InternalSession
A Session used internally in the ServerPod. Typically used to access the database and do logging for events that are not triggered from a call, or a stream.
IntPathParam
A path parameter accessor that parses values as int.
IntQueryParam
A query parameter accessor that parses values as int.
IPAddress
Represents an IPv4 or IPv6 address, optionally with a CIDR prefix length.
IPv4Address
Represents an IPv4 address with optional CIDR prefix.
IPv6Address
Represents an IPv6 address with optional CIDR prefix.
IvfflatIndexQueryOptions
Query options for the IVFFLAT index.
JsonWidget
A WebWidget that renders JSON output. The output will be the result of passing the provided object to jsonEncode.
LanguageQuality
A class representing a language with an optional quality value.
ListWidget
Combines a List of WebWidgets into a single WebWidget.
LookupResult<T>
Represents the result of looking up a route in the router.
ManyRelation<T extends Table>
Many relation field between two tables.
MapRuntimeParameters
Runtime parameters that can be built from a map of options.
MediaRange
A class representing a media range with an optional quality value.
Message
MessageCentral
The MessageCentral handles communication within the server, and between servers in a cluster. It is especially useful when working with streaming endpoints. The message central can pass on any serializable to a channel. The channel can be listened to by from any place in the server.
MessageCentralAccess
Provides access to the Serverpod's MessageCentral.
MessageCentralServerpodChannels
Channels that are listened to by the Serverpod Framework.
MethodCallContext
Context for a MethodConnector call
MethodCallOpContext
The context of a method call operation.
MethodCallSession
When a call is made to the Server a MethodCallSession object is created. It contains all data associated with the current connection and provides easy access to the database.
MethodConnector
The MethodConnector hooks up a method with its name and the actual call to the method.
MethodMiss<T>
Indicates that a route exists for the path, but not for the HTTP method.
MethodStreamCallContext
Context for a MethodStreamConnector call
MethodStreamConnector
The MethodStreamConnector hooks up a method with its name and implementation. The method communicates with the client using a websocket connection. Enabling support for streaming return values or parameters.
MethodStreamMessage
A message sent to a method stream.
MethodStreamSerializableException
A serializable exception sent over a method stream.
MethodStreamSession
When a connection is made to the Server to an endpoint method that uses a stream MethodStreamSession object is created. It contains all data associated with the current connection and provides easy access to the database.
MiddlewareObject
An abstract base class for classes that behave like Middleware.
MimeType
A MIME type representing the format of content.
Miss<T>
Base class for lookup failures.
MutableHeaders
NoneExpression<T>
A database expression that returns all rows where none of the related rows match the filtering criteria.
NotExpression
A database expression to invert the result of another expression.
NumPathParam
A path parameter accessor that parses values as num.
NumQueryParam
A query parameter accessor that parses values as num.
OpenMethodStreamCommand
A message sent over a websocket connection to open a websocket stream of data to an endpoint method.
OpenMethodStreamResponse
A message sent over a websocket connection to respond to an OpenMethodStreamCommand.
OperationEventContext
Represents the operation that the event was caused by or in relation to. An operation is a client-originated call / operation or a scheduled operation, i.e. a method call, a streaming call, a web call, or a future call.
Order
Defines how to order a database column.
ParameterDescription
Defines a parameter in a MethodConnector.
PathCacheMaxAge
DEPRECATED: Use StaticRoute.directory with CacheControlFactory instead A path pattern to match, and the max age that paths that match the pattern should be cached for, in seconds.
PathMiss<T>
Indicates that no route exists for the requested path.
PathParam<T extends Object>
A read-only accessor for extracting typed path parameters.
PathParameters
Holds path parameters extracted from a matched route.
PermissionsPolicyDirective
A class representing a single Permissions-Policy directive.
PermissionsPolicyHeader
A class representing the HTTP Permissions-Policy header.
PgErrorCode
A class containing constants for PostgreSQL error codes.
PingCommand
A message sent over a websocket connection to check if the connection is still alive. The other end should respond with a PongCommand.
Pipeline
A helper that makes it easy to compose a set of Middleware and a Handler.
PongCommand
A response to a PingCommand.
ProtocolSerialization
The ProtocolSerialization defines a toJsonForProtocol method which makes it possible to limit what fields are serialized
QueryParam<T extends Object>
A read-only accessor for extracting typed query parameters.
QueryParameters
Provides parameters for direct database queries
QueryParametersNamed
Named parameters for direct database queries.
QueryParametersPositional
Positional parameters for direct database queries
Range
A class representing a single range within a Range header.
RangeHeader
A class representing the HTTP Range header.
ReadOnlyAccessor<T extends Object, K, R>
A read-only accessor for extracting typed values from a keyed storage.
RedirectWidget
A WebWidget that renders a HTTP redirect to the provided url.
RedisConfig
Configuration for Redis.
ReferrerPolicyHeader
A class representing the HTTP Referrer-Policy header.
RelicApp
The main application class for a Relic web server.
RelicServer
RelicWebSocket
An relic specific interface for bi-directional communication over web-sockets.
Request
An HTTP request to be processed by a Relic Server application.
Response
The response returned by a Handler.
Result
A sealed base class representing the result of handling a request.
RetryAfterHeader
A class representing the HTTP Retry-After header.
RevokedAuthenticationAuthId
Message sent when an authentication key id is revoked.
RevokedAuthenticationScope
Message sent when authentication scopes for a user are revoked.
RevokedAuthenticationUser
Message sent when all authentication for a user is revoked.
Route
A Route defines a destination in Serverpod's web server. It will handle a call and generate an appropriate response by manipulating the Request object. You override Route, or more likely it's subclass WidgetRoute to create your own custom routes in your server.
Router<T extends Object>
A URL router that maps path patterns to values of type T.
RouterMatch<T>
A successful route match containing the handler value and extracted parameters.
RouteStaticDirectory
DEPRECATED: Use StaticRoute.directory instead Route for serving a directory of static files.
RuntimeParameters
Base class for runtime parameters group to apply to the database.
RuntimeParametersBuilder
Builder class for runtime parameters that provides discoverable factory methods. This enables the callback pattern: setRuntimeParameters((params) => ...)
SameSite
Cookie cross-site availability configuration.
Savepoint
A savepoint in a transaction.
Scope
Used to define who can access an Endpoint. Authenticated users can be associated with a Scope, if the same scope is defined in the Endpoint the user is granted access. The scope is defined by its name.
SearchPathsConfig
Search path configuration for database schema resolution.
SecFetchDestHeader
A class representing the HTTP Sec-Fetch-Dest header.
SecFetchModeHeader
A class representing the HTTP Sec-Fetch-Mode header.
SecFetchSiteHeader
A class representing the HTTP Sec-Fetch-Site header.
SecurityContextConfig
Configuration for the security context.
SerializableModel
The SerializableModel is the base interface for all serializable objects in Serverpod, except primitives.
SerializationManager
The SerializationManager is responsible for creating objects from a serialization, but also for serializing objects. This class is typically extended by generated code.
SerializationManagerServer
The SerializationManager is responsible for creating objects from a serialization, but also for serializing objects. This class is typically overridden by generated code. SerializationManagerServer is an extension to also handle Tables.
Server
Handling incoming calls and routing them to the correct Endpoint methods.
ServerConfig
Configuration for a server.
ServerHealthMetric
Represents a snapshot of a specific health metric. An entry is written every minute for each server. All health data can be accessed through Serverpod Insights.
ServerHealthMetricInclude
ServerHealthMetricIncludeList
ServerHealthMetricRepository
ServerHealthMetricTable
ServerHealthMetricUpdateTable
Serverpod
The Serverpod handles all setup and manages the main Server. In addition to the user managed server, it also runs a server for handling the DistributedCache and other connections through the InsightsEndpoint.
ServerpodConfig
Parser for the Serverpod configuration file.
ServerpodRunMode
Defines valid run modes for the Serverpod.
Session
When a call is made to the Server a Session object is created. It contains all data associated with the current connection and provides easy access to the database.
SessionLogConfig
Configuration for session logging.
SessionLogUtils
A collection of utils for the database backed session logs.
SetCookieHeader
A class representing the HTTP Set-Cookie header.
SpaRoute
Route for serving Single Page Applications (SPAs) with fallback support.
SparseVector
Represents a sparse vector that stores only non-zero elements.
StaticHandler
A HandlerObject that serves static files from a directory or a single file.
StaticRoute
Route for serving static assets.
StorageAccess
Collects methods for accessing cloud storage.
StreamingSession
When a web socket connection is opened to the Server a StreamingSession object is created. It contains all data associated with the current connection and provides easy access to the database.
StreamOpContext
The context of a stream operation / message.
StreamParameterDescription<T>
Description of a stream parameter.
StrictTransportSecurityHeader
Represents the HTTP Strict-Transport-Security (HSTS) header for managing HSTS settings.
Table<T_ID>
Represents a database table.
TableRow<T_ID>
Holds data corresponding to a row in the database. Concrete classes are typically generated. Instances of TableRow can also be serialized and either passed to clients or cached.
TEHeader
A class representing the HTTP TE header.
Templates
Loads and caches templates.
TemplateWidget
A WebWidget based on a HTML template. The name of the template should correspond to a template file in your server's web/templates directory. Set the custom values of the template by populating the values field. If values are set that aren't Strings, the toString method will be called on the value. The templates are loaded when the server starts. If you add new templates or modify existing templates, you will need to restart the server for them to take effect.
TeQuality
A class representing a transfer encoding with an optional quality value.
Transaction
Holds the state of a running database transaction.
TransactionSettings
Settings for a transaction.
TransferEncoding
A class representing valid transfer encodings.
TransferEncodingHeader
A class representing the HTTP Transfer-Encoding header.
TwoPartExpression
A database expression with two parts.
TypedEventHandler<T extends DiagnosticEvent>
A DiagnosticEventHandler that handles events of a specific type.
UpdateTable<T extends Table>
Base class for database table update operations.
UpgradeHeader
A class representing the HTTP Upgrade header.
UpgradeProtocol
A class representing a single protocol in the Upgrade header.
Uuid
uuid for Dart Author: Yulian Kuncheff Released under MIT License.
UuidValue
VaryHeader
A class representing the HTTP Vary header.
Vector
Represents a vector of double values.
VectorDistanceExpression<T>
Vector distance expression for use with pgvector.
VectorIndexQueryOptions
Query options for vector indexes.
WasmHeadersMiddleware
Middleware that adds WebAssembly multi-threading headers to responses.
WebCallOpContext
The context of a web call operation.
WebCallSession
When a request is made to the web server a WebCallSession object is created. It contains all data associated with the current connection and provides easy access to the database.
WebServer
The Serverpod webserver.
WebSocketMessage
Base class for messages sent over a WebSocket connection.
WebSocketMessageInfo
Interface of WebSocketMessage subclasses that have endpoint, method and connection id info.
WebSocketUpgrade
A Result indicating that a duplex stream connection (e.g., WebSocket) has been established.
WebWidget
The base class for all web widgets. Override this class to create a custom widget type, or use one of the default types which covers most common use cases.
Widget
Deprecated alias for TemplateWidget. The base Widget class has been renamed to TemplateWidget for clarity.
WidgetJson
Deprecated alias for JsonWidget. WidgetJson has been renamed to JsonWidget for consistency.
WidgetList
Deprecated alias for ListWidget. WidgetList has been renamed to ListWidget for consistency.
WidgetRedirect
Deprecated alias for RedirectWidget. WidgetRedirect has been renamed to RedirectWidget for consistency.
WidgetRoute
A WidgetRoute is the most convenient way to create routes in your server. Override the build method and return an appropriate WebWidget.
XForwardedForHeader
Typed representation of the X-Forwarded-For (XFF) HTTP header.

Enums

AuthenticationFailureReason
The type of failures that can occur during authentication.
CloseReason
The reason a stream was closed.
ConsoleLogFormat
Valid values for console log format.
EnumSerialization
IsolationLevel
Isolation levels for transactions.
IterativeScan
Automatically scan more of the index until enough results are found.
LogLevel
Represents different log levels.
Method
Represents the HTTP methods used in requests as constants.
MethodStreamReturnType
The type of return value from a MethodStreamConnector.
Namespace
RFC4122 & RFC9562 provided namespaces for v3, v5, and v8 namespace based UUIDs
OpenMethodStreamResponseType
The response to an OpenMethodStreamCommand.
OperationType
Represents the type of "operation" during which the event was caused.
OriginSpace
Denotes whether an event's origin is application (user) space or framework space.
ServerpodLoggingMode
The overarching logging mode of the server. This can be set to either normal or verbose. In normal mode, only important messages are logged, which is the default.
ValidationMode
The options for UUID Validation strictness

Extension Types

A "class" representing a typed header.

Extensions

Base64Dec on String
Extension for decoding ByteData in protocol.
Base64Enc on ByteData
Extension for encoding ByteData in the protocol.
BigIntJsonExtension on BigInt
Expose toJson on BigInt Expose static fromJson builder
BitJsonExtension on Bit
Expose toJson on Bit
ByteDataJsonExtension on ByteData
Expose toJson on ByteData Expose static fromJson builder
CloneBit on Bit
Adds clone method that create a deep copy of a Bit vector.
CloneByteData on ByteData
Adds clone method that create a deep copy of a ByteData.
CloneHalfVector on HalfVector
Adds clone method that create a deep copy of a HalfVector.
CloneSparseVector on SparseVector
Adds clone method that create a deep copy of a SparseVector.
CloneVector on Vector
Adds clone method that create a deep copy of a ByteData.
DateTimeJsonExtension on DateTime
Expose toJson on DateTime Expose static fromJson builder
DurationJsonExtension on Duration
Expose toJson on Duration Expose static fromJson builder
HalfVectorJsonExtension on HalfVector
Expose toJson on HalfVector
HeadersEx on Headers
IdColumnIterable on Iterable
An extension on iterable for Id columns.
ListJsonExtension on List<T>
Expose toJson on List
LookupResultExtension on LookupResult<T>
Extension providing convenient type casting for LookupResult instances.
MapJsonExtension on Map<K, V>
Expose toJson on Map
MiddlewareExtensions on Middleware
Extensions on Middleware to aid in composing Middleware and Handlers.
MutableHeadersEx on MutableHeaders
PathParametersRequestEx on Request
QueryParametersRequestEx on Request
RawEx on Map<K, R>
RequestExtension on Request
Extends Request with useful methods.
RouteEx on Router<T>
RouterHandlerEx on RelicRouter
Extension on RelicRouter that cater specifically to Handlers.
RoutingRequestEx on Request
Extension on Request providing access to routing information.
SessionEx on Request
Session related extension methods for Request.
SetJsonExtension on Set<T>
Expose toJson on Set
SparseVectorJsonExtension on SparseVector
Expose toJson on SparseVector
TableRowDatabaseJsonExtension on TableRow
Extension on a TableRow to ensure database serialization matches the expected naming of the column in the database
Uint16ListConversionExtensions on Uint16List
UriEx on Uri
Extension methods for Uri used in tests and internal utilities.
UriJsonExtension on Uri
Expose toJson on Uri Expose static fromJson builder
UuidValueJsonExtension on UuidValue
Expose toJson on UuidValue Expose static fromJson builder
VectorDatabase on Database
Extension to add vector specific utilities to the database.
VectorJsonExtension on Vector
Expose toJson on Vector

Constants

autoSerializedTypes → const List<String>
All datatypes that are serialized by default. Used internally in Serverpod code generation.
basicAuthSchemeName → const String
The name of the default Serverpod scheme for HTTP "authorization" headers. Note, the scheme name is case-insensitive and should be compared in a case-insensitive manner.
bearerAuthSchemeName → const String
The name of the Bearer scheme for HTTP "authorization" headers. Note, the scheme name is case-insensitive and should be compared in a case-insensitive manner.
doNotGenerate → const _DoNotGenerate
Used to annotate endpoint classes and methods that should be ignored by the Serverpod code analyzer and generator.
extensionSerializedTypes → const List<String>
All datatypes that has extensions to support serialization. Used internally in Serverpod code generation.
hasCloneExtensionTypes → const List<String>
List of types that has a clone method extension and therefore can be copied by calling clone().
immutable → const Immutable
Used to annotate a class C. Indicates that C and all subtypes of C must be immutable.
unauthenticatedClientCall → const _UnauthenticatedClientCall
Used to annotate endpoint classes and methods that should not use authentication.
useResult → const UseResult
Used to annotate a method, field, or getter within a class, mixin, or extension, or a or top-level getter, variable or function to indicate that the value obtained by invoking it should be used. A value is considered used if it is assigned to a variable, passed to a function, or used as the target of an invocation, or invoked (if the result is itself a function).

Properties

nonMutableTypeNames List<String>
List of types that are not mutable and therefore do not need to be copied or handled in a copyWith method.
final
templates Templates
Global access to all templates loaded when starting the webserver.
final

Functions

createMiddleware({FutureOr<Response?> onRequest(Request)?, FutureOr<Response> onResponse(Response)?, FutureOr<Response> onError(Object error, StackTrace)?}) Middleware
Creates a Middleware using the provided functions.
createRelationTable<T>({required String relationFieldName, required Column field, required Column foreignField, TableRelation? tableRelation, required T createTable(TableRelation foreignTableRelation)}) → T
Creates a new Table containing TableRelation with information about how the tables are joined.
equalsType<T_ID, Y>() bool
Checks if the type T is equal to type Y (nullable or non-nullable).
getStaticFileInfo(File file, {MimeTypeResolver? mimeResolver}) Future<FileInfo>
Public accessor for retrieving FileInfo for a given file.
getType<T>() Type
Get the type provided as an generic. Useful for getting a nullable type.
isValidAuthHeaderValue(String value) bool
Returns true if the provided value is a valid HTTP "authorization" header value (which includes starting with an authentication scheme name).
isWrappedBasicAuthHeaderValue(String value) bool
Returns true if the provided value is a Serverpod-wrapped auth key.
isWrappedBearerAuthHeaderValue(String value) bool
Returns true if the provided value is a Bearer auth header value.
logRequests({Logger? logger}) Middleware
Middleware which prints the time of the request, the elapsed time for the inner handlers, the response's status code and the request URI.
respondWith(Responder responder) Handler
Creates a Handler that uses the given Responder function to generate a response.
routeWith<T extends Object>(Router<T> router, {bool backtrack = true, Handler toHandler(T)?}) Middleware
Creates middleware that routes requests using the provided router.
unwrapAuthHeaderValue(String? authValue) String?
Returns the auth key from an auth value that has potentially been wrapped. This operation is the inverse of wrapAsBasicAuthHeaderValue and wrapAsBearerAuthHeaderValue. If null is provided, null is returned.
wrapAsBasicAuthHeaderValue(String key) String
Returns a value that is compliant with the HTTP auth header format by encoding and wrapping the provided auth key as a Basic auth value.
wrapAsBearerAuthHeaderValue(String token) String
Returns a value that is compliant with the HTTP auth header format by wrapping the provided token as a Bearer auth value. Unlike Basic auth, Bearer tokens are not Base64 encoded as they are expected to already be in the correct format.

Typedefs

AuthenticationHandler = Future<AuthenticationInfo?> Function(Session session, String token)
Returns authentication information for a given Session and token or null if the key is invalid.
CacheControlFactory = CacheControlHeader? Function(Request req, FileInfo fileInfo)
ColumnSelections<T extends Table> = List<Column> Function(T)
A function that returns a Column for a Table.
ColumnValueListBuilder<T extends UpdateTable<Table>> = List<ColumnValue> Function(T)
A function that returns a list of ColumnValues for a UpdateTable.
ConnectionsInfo = ({int active, int closing, int idle})
Convert<T> = T Function(String value)
The configuration sections for the serverpod configuration file.
EventHandlerFunction<T extends DiagnosticEvent> = void Function(T event, {required DiagnosticEventContext context, required OriginSpace space})
Function signature type for functions that handle a DiagnosticEvent.
FutureCallSessionBuilder = Session Function(String futureCallName)
A function that builds a Session for a FutureCall.
Handler = FutureOr<Result> Function(Request req)
A function that processes a Request to produce a Result.
HeaderTuple<T extends Object> = ({HeaderAccessor<T> accessor, HeadersBase headers})
Internal record for bundling an accessor with its externalized state headers.
HealthCheckHandler = Future<List<ServerHealthMetric>> Function(Serverpod pod, DateTime timestamp)
Performs a set of custom health checks on a Serverpod.
HijackCallback = void Function(StreamChannel<List<int>>)
A callback function that handles a hijacked connection.
InitializeFutureCall = void Function(FutureCall<SerializableModel> futureCall, String name)
A function that initializes a FutureCall.
MessageCentralListenerCallback = void Function(SerializableModel message)
The callback used by listeners of the MessageCentral.
MethodCall = Future Function(Session session, Map<String, dynamic> params)
Calls a named method referenced in a MethodConnector.
MethodStream = dynamic Function(Session session, Map<String, dynamic> params, Map<String, Stream> streamParams)
Calls a named method referenced in a MethodStreamConnector.
Middleware = Handler Function(Handler next)
A function which creates a new Handler by wrapping a Handler.
OrderByBuilder<T extends Table> = Column Function(T)
A function that returns a Column for a Table to be used with order by
OrderByListBuilder<T extends Table> = List<Order> Function(T)
A function that returns a list of Order for a Table to be used with order by list.
RawPathParam = String
RawQueryParam = String
RelicRouter = Router<Handler>
Just a typedef for better auto-complete ///
Responder = FutureOr<Response> Function(Request)
A simplified handler function that takes a Request and returns a Response.
RouterInjectable = InjectableIn<RelicRouter>
A contract for modular route registration in Relic applications.
RuntimeParametersListBuilder = List<RuntimeParameters> Function(RuntimeParametersBuilder params)
A function that returns a list of RuntimeParameters for configuring database runtime parameters.
TransactionFunction<R> = Future<R> Function(Transaction transaction)
A function performing a transaction, passed to the transaction method.
WebSocketCallback = void Function(RelicWebSocket webSocket)
A callback function invoked when a socket connection is established.
WhereExpressionBuilder<T extends Table> = Expression Function(T)
A function that returns an Expression for a Table to be used with where clauses.
WillCloseListener = FutureOr<void> Function(Session session)
A listener that will be called when the session is about to close.

Exceptions / Errors

AuthHeaderEncodingException
An exception thrown upon erroneous encoding of an auth header.
CloudStorageException
Exception thrown by CloudStorage.
DatabaseDeleteRowException
Exception thrown when a delete row operation fails.
DatabaseException
Exception thrown when an error occurs in the database.
DatabaseInsertRowException
Exception thrown when an insert row operation fails.
DatabaseQueryException
Exception thrown when an exception occurs during a database query.
DatabaseUpdateRowException
Exception thrown when an update row operation fails.
DeserializationTypeNotFoundException
Exception thrown when no deserialization type was found during protocol deserialization
EndpointDispatchException
The result of a failed EndpointDispatch.getMethodStreamCallContext, EndpointDispatch.getMethodCallContext or EndpointDispatch.getEndpointConnector call.
EndpointNotFoundException
The endpoint was not found.
ExitException
Exception used to signal a non-recoverable error that should exit the application.
HeaderException
HeaderException serves as the common supertype for specific exceptions that can occur when processing HTTP headers.
InvalidEndpointMethodTypeException
The found endpoint method was not of the expected type.
InvalidHeaderException
Exception thrown for invalid HTTP header values.
InvalidParametersException
The input parameters were invalid.
MaxBodySizeExceeded
Exception thrown when the body size exceeds the maximum allowed length.
MethodNotFoundException
The endpoint method was not found.
MissingHeaderException
Exception thrown when a required HTTP header is missing.
NotAuthorizedException
The user is not authorized to access the endpoint.
PasswordMissingException
Exception class for all password missing exceptions.
RollbackToSavepointFailedException
Exception thrown when an attempt to rollback to a savepoint in response to clean up after another exception fails.
SerializableException
This is SerializableException that can be used to pass Domain exceptions from the Server to the Client
UnknownMessageException
Exception thrown when an unknown message is received.