serverpod library

Classes

AbstractWidget
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.
AnyExpression<T>
A database expression that returns all rows where any of the related rows match the filtering criteria.
AuthenticationInfo
Holds the id for an authenticated user and which scopes it can access. Allowed scopes are defined for each Endpoint.
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.
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.
ColumnBool
A Column holding an bool.
ColumnByteData
A Column holding ByteData.
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.
ColumnInt
A Column holding an int.
ColumnSerializable
A Column holding an SerializableModel. The entity will be stored in the database as a json column.
ColumnString
A Column holding an String.
ColumnUuid
A Column holding UuidValue.
Constant
A constant Expression.
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.
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 MethodConnectors.
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.
EscapedExpression
A database expression that is escaped. This is used to escape values that are not expressions, such as strings and numbers.
EveryExpression<T>
A database expression that returns all rows where all of the related rows match the filtering criteria.
ExceptionResult<T extends SerializableException>
The result of a failed Endpoint method call, with a custom exception.
Expression<T>
A database Expression.
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.
FutureCallSession
Created when a FutureCall is being made. It contains all data associated with the current call and provides easy access to the database.
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.
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.
ManyRelation<T extends Table>
Many relation field between two tables.
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.
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.
Namespace
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.
Order
Defines how to order a database column.
ParameterDescription
Defines a parameter in a MethodConnector.
ProtocolSerialization
The ProtocolSerialization defines a toJsonForProtocol method which makes it possible to limit what fields are serialized
QueryParameters
Provides parameters for direct database queries
QueryParametersNamed
Named parameters for direct database queries.
QueryParametersPositional
Positional parameters for direct database queries
RedisConfig
Configuration for Redis.
Result
The Result of an Endpoint method call.
ResultAuthenticationFailed
The result of a failed Endpoint method call where authentication failed.
ResultInternalServerError
The result of a failed Endpoint method call where an Exception was thrown during execution of the method.
ResultInvalidParams
The result of a failed Endpoint method call where the parameters where not valid.
ResultStatusCode
The result of a failed Endpoint method call, with a custom status code.
ResultSuccess
A successful result from an Endpoint method call containing the return value of the call.
Route
A Route defines a destination in Serverpod's web server. It will handle a call and generate an appropriate response by manipulating the HttpRequest object. You override Route, or more likely it's subclass WidgetRoute to create your own custom routes in your server.
RouteStaticDirectory
Route for serving a directory of static files.
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.
SerializableEntity
DEPRECATED: This class is deprecated and will be removed in version 2.1. Please implement the SerializableModel interface instead for creating serializable models.
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
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.
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.
Table
Represents a database table.
TableRow
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.
Templates
Loads and caches templates.
Transaction
Holds the state of a running database transaction.
TwoPartExpression
A database expression with two parts.
Uuid
uuid for Dart Author: Yulian Kuncheff Released under MIT License.
UuidValue
WebServer
The Serverpod webserver.
Widget
A widget 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.
WidgetJson
A widget that renders JSON output. The output will be the result of passing the provided object to jsonEncode.
WidgetList
Combines a List of Widgets into a single widget.
WidgetRedirect
A widget that renders a HTTP redirect to the provided url.
WidgetRoute
A WidgetRoute is the most convenient way to create routes in your server. Override the build method and return an appropriate Widget.

Enums

AuthenticationFailureReason
The type of failures that can occur during authentication.
EnumSerialization
LogLevel
Represents different log levels.
RouteMethod
Defines HTTP call methods for routes.
ValidationMode
The options for UUID Validation strictness

Extensions

Base64Dec on String
Extension for decoding ByteData in protocol.
Base64Enc on ByteData
Extension for encoding ByteData in the protocol.
ByteDataJsonExtension on ByteData
Expose toJson on ByteData Expose static fromJson builder
CloneByteData on ByteData
Adds clone method that create a deep copy of a ByteData.
CloneList on List
Adds clone method that create a deep copy of a list.
CloneMap on Map
Adds clone method that create a deep copy of a map.
DateTimeJsonExtension on DateTime
Expose toJson on DateTime Expose static fromJson builder
DurationJsonExtension on Duration
Expose toJson on Duration Expose static fromJson builder
ListJsonExtension on List<T>
Expose toJson on List
MapJsonExtension on Map<K, V>
Expose toJson on Map
RemoteIp on HttpRequest
Extends HttpRequest with useful methods.
UuidValueJsonExtension on UuidValue
Expose toJson on UuidValue Expose static fromJson builder

Constants

autoSerializedTypes → const List<String>
All datatypes that are serialized by default. Used internally in Serverpod code generation.
clonableTypeNames → const List<String>
List of types that has a clone method extension and therefore can be copied by calling clone().
extensionSerializedTypes → const List<String>
All datatypes that has extensions to support serialization. Used internally in Serverpod code generation.

Properties

noneMutableTypeNames 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

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.
getType<T>() Type
Get the type provided as an generic. Useful for getting a nullable type.

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.
ColumnSelections<T extends Table> = List<Column> Function(T)
A function that returns a Column for a Table.
HealthCheckHandler = Future<List<ServerHealthMetric>> Function(Serverpod pod, DateTime timestamp)
Performs a set of custom health checks on a Serverpod.
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.
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.
TransactionFunction<R> = Future<R> Function(Transaction transaction)
A function performing a transaction, passed to the transaction method.
WhereExpressionBuilder<T extends Table> = Expression Function(T)
A function that returns an Expression for a Table to be used with where clauses.

Exceptions / Errors

CloudStorageException
Exception thrown by CloudStorage.
DatabaseDeleteRowException
Exception thrown when no rows is deleted when deleting a row.
DatabaseException
Exception thrown when an error occurs during a database operation.
DatabaseInsertRowException
Exception thrown when no row is inserted when inserting a row.
DatabaseUpdateRowException
Exception thrown when no rows is updated when updating a row.
DeserializationTypeNotFoundException
Exception thrown when no deserialization type was found during protocol deserialization
SerializableException
This is SerializableException that can be used to pass Domain exceptions from the Server to the Client