ServerpodClientShared class abstract

Superclass with shared methods for handling communication with the server. Is typically overridden by generated code to provide implementations of methods for calling the server.

Inheritance
Available extensions

Constructors

ServerpodClientShared(String host, SerializationManager serializationManager, {dynamic securityContext, required Duration? streamingConnectionTimeout, required Duration? connectionTimeout, void onFailedCall(MethodCallContext callContext, Object error, StackTrace stackTrace)?, void onSucceededCall(MethodCallContext callContext)?, bool? disconnectStreamsOnLostInternetConnection, Client? httpClientOverride})
Creates a new ServerpodClientShared.

Properties

authKeyProvider ClientAuthKeyProvider?
Provides the authentication key for the client. Required to make authenticated requests. If not provided, all requests will be unauthenticated.
getter/setter pair
authRefreshCrossTabLock CrossTabLock?

Available on ServerpodClientShared, provided by the ServerpodClientCookieAuth extension

A lock serializing authentication refreshes against this server across browser tabs, or null when the platform has no cross-tab coordination. The lock name is derived from the host origin and base path and carries no secrets.
no setter
connectionTimeout Duration
Timeout when calling a server endpoint. If no response has been received, defaults to 20 seconds.
final
connectivityMonitor ConnectivityMonitor?
Set a connectivity monitor to better manage streaming connections. You can find the FlutterConnectivityMonitor in the serverpod_flutter package.
getter/setter pair
cookieAuth bool

Available on ServerpodClientShared, provided by the ServerpodClientCookieAuth extension

Whether the client should use browser-managed cookie auth transport.
getter/setter pair
endpointRefLookup Map<String, EndpointRef>
Looks up an EndpointRef by its name. This method is typically only used internally and overridden by generated code.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
host String
Full url to the Serverpod server. E.g. "https://example.com/"
final
moduleLookup Map<String, ModuleEndpointCaller>
Looks up module callers by their name. Overridden by generated code.
no setter
onFailedCall → void Function(MethodCallContext callContext, Object error, StackTrace stackTrace)?
Callback when any call to the server fails or an exception is thrown.
final
onSucceededCall → void Function(MethodCallContext callContext)?
Callback when any call to the server succeeds.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serializationManager SerializationManager
The SerializationManager used to serialize objects sent to the server.
final
streamingConnectionTimeout Duration
Timeout when opening a web socket connection for a streaming method call. If the connection has not been established within the timeout duration the socket will be closed.
final

Methods

callServerEndpoint<T>(String endpoint, String method, Map<String, dynamic> args, {bool authenticated = true}) Future<T>
Calls a server endpoint method by its name, passing arguments in a map. Typically, this method is called by generated code.
override
callStreamingServerEndpoint<T, G>(String endpoint, String method, Map<String, dynamic> args, Map<String, Stream> streams, {bool authenticated = true}) → dynamic
Calls a server endpoint method that supports streaming. The streams parameter is a map of stream names to stream objects. The method will listen to the streams and send the data to the server. Typically, this method is called by generated code.
override
close() → void
Closes all open connections to the server.
closeStreamingMethodConnections({Object? exception = const WebSocketClosedException()}) Future<void>
Closes all open streaming method connections.
getEndpointOfType<T extends EndpointRef>([String? name]) → T
Returns an endpoint of type T. If more than one endpoint of type T exists, name can be used to disambiguate.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited