DevConnector class

Connects to the PowerSync service in development mode.

Development mode has the following functionality:

  1. Login using static username & password combinations, returning DevCredentials.
  2. Refresh PowerSync token using DevCredentials.
  3. Write directly to the SQL database using a basic update endpoint.

By default, credentials are stored in memory only. Subclass and override DevConnector.storeDevCredentials and DevConnector.loadDevCredentials to use persistent storage.

Development mode is intended to get up and running quickly, but is not for production use. For production, write a custom connector.

Inheritance
Annotations
  • @Deprecated('We will be removing this in version 2.')

Constructors

DevConnector()

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

clearDevToken() Future<void>
Clear the dev token.
devLogin({required String endpoint, required String user, required String password}) Future<void>
Use the PowerSync dev API to log in.
fetchCredentials() Future<PowerSyncCredentials?>
Get credentials for PowerSync.
override
getCredentialsCached() Future<PowerSyncCredentials?>
Get credentials current cached, or fetch new credentials if none are available.
inherited
getEndpoint() Future<String?>
Get the dev endpoint associated with the dev credentials.
getUserId() Future<String?>
Get the user id associated with the dev credentials.
hasCredentials() Future<bool>
Whether a dev token is available.
invalidateCredentials() → void
Immediately invalidate credentials.
inherited
loadDevCredentials() Future<DevCredentials?>
Load the stored credentials.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prefetchCredentials() Future<PowerSyncCredentials?>
Fetch a new set of credentials and cache it.
inherited
storeDevCredentials(DevCredentials credentials) Future<void>
Store the credentials after login, or when clearing / changing it.
toString() String
A string representation of this object.
inherited
uploadData(PowerSyncDatabase database) Future<void>
Upload changes using the PowerSync dev API.
override

Operators

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