SurrealClient constructor
Requires url
for target SurrealDB instance.
url
have to be a full path to the RPC endpoint
so provide it like eg. https://your.instance/rpc.
If provided, token
will be used to authenticate
the connection.
idGenerator
allows you to override default ObjectId's
assigned to each RPC with custom id solution.
Ids generated with idGenerator
regards only RPC,
random ids for newly created objects will be handled
by the target instance.
Implementation
SurrealClient({
required String url,
String token = '',
IdGenerator? idGenerator,
}) : _url = url,
_token = token,
_generateId = idGenerator ?? objectId {
connect(_url);
}