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.
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 SerializableEntity. 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.
DatabaseConnection
A connection to the database. In most cases the Database db object in the Session object should be used when connecting with the database.
DatabasePoolManager
Configuration for connecting to the Postgresql database.
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 SerializableEntity>
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.
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
The SerializableEntity is the base class 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 overriden by generated code. SerializationManagerServer is an extension to also handle Tables.
Server
Handling incoming calls and routing them to the correct Endpoint methods.
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.
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.
UserAuthetication
Collects methods for authenticating users.
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 convienient way to create routes in your server. Override the build method and return an appropriate Widget.

Enums

EnumSerialization
LogLevel
Represents different log levels.
RouteMethod
Defines HTTP call methods for routes.
ValidationMode
The options for UUID Validation strictness

Extensions

AuthKeyScopes on AuthKey
Adds methods for scopes on AuthKey.
Base64Dec on String
Extension for decoding ByteData in protocol.
Base64Enc on ByteData
Extension for encoding ByteData in the protocol.
ByteDataToJson on ByteData
Expose toJson on ByteData
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.
DateTimeToJson on DateTime
Expose toJson on DateTime
DurationToJson on Duration
Expose toJson on Duration
ListToJson on List<T>
Expose toJson on List
MapToJson on Map<K, V>
Expose toJson on Map
RemoteIp on HttpRequest
Extends HttpRequest with useful methods.
UuidValueToJson on UuidValue
Expose toJson on UuidValue

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
tServerHealthMetric ServerHealthMetricTable
getter/setter pair

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 key)
Returns authentication information for a given Session and key or null if the key is invalid.
ColumnSelections<T extends Table> = List<Column> Function(T)
A function that returns a Column for a Table.
constructor<T> = T Function(dynamic jsonSerialization, SerializationManager serializationManager)
The constructor takes JSON structure and turns it into a decoded SerializableEntity.
HealthCheckHandler = Future<List<ServerHealthMetric>> Function(Serverpod pod, DateTime timestamp)
Performs a set of custom health checks on a Serverpod.
MessageCentralListenerCallback = void Function(SerializableEntity 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.
SerializableException
This is SerializableException that can be used to pass Domain exceptions from the Server to the Client