Clients class

A factory of Clients.

Creates Clients for posting commands, sending queries, and managing subscriptions on behalf of a certain user.

Example:

import 'package:spine_client/client.dart';
import './types.dart' as myTypes;

var clients = Clients(
    'https://example.org/',
    firebase: WebFirebaseClient(FirebaseApp().database),
    typeRegistries: [myTypes.types()]
);
var actor = UserId()
    ..value = 'some-user-id';
var client = clients.onBehalfOf(actor);

// ...

var cmdRequest = client.command(postComment);
var events = cmdRequest.observeEvents<CommentPosted>();
cmdRequest.post();

events.forEach((event) {
    // Do something when an event is fired.
});

Constructors

Clients(String baseUrl, {UserId? guestId = null, TenantId? tenantId = null, ZoneOffset? zoneOffset = null, ZoneId? zoneId = null, QueryMode queryMode = QueryMode.FIREBASE, FirebaseClient? firebase = null, Endpoints? endpoints = null, Duration subscriptionKeepUpPeriod = const Duration(minutes: 2), List typeRegistries = const [], HttpTranslator? httpTranslator = null})
Creates a new instance of Clients.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

asGuest() Client
Creates a new client which sends requests on behalf of a guest user.
cancelAllSubscriptions() → void
Cancels all the active subscriptions
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onBehalfOf(UserId user) Client
Creates a new client which sends requests on behalf of the given user.
toString() String
A string representation of this object.
inherited

Operators

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