Get Started
Quickstart
Get started with PocketSync in your Flutter application
Installation
Requirements
- A PocketSync account (sign up at pocketsync.dev)
Our SDKs
Add dependency
Basic setup
- Create a project in the PocketSync console
- Initialize PocketSync in your app:
Configuration
PocketSync can be configured with various options to customize its behavior. The PocketSyncOptions
class accepts the following parameters:
Parameter | Description | Default |
---|---|---|
projectId | Your project ID from the PocketSync dashboard | Required |
authToken | Authentication token from the PocketSync dashboard | Required |
serverUrl | PocketSync server URL | https://api.pocketsync.dev |
changeLogRetentionDays | Number of days to retain change logs | 30 |
syncExistingData | Whether to sync existing data | true |
conflictResolutionStrategy | Strategy for resolving conflicts | lastWriteWins |
customResolver | Custom conflict resolver function | null |
verbose | Enable detailed logging | false |
Example configuration with custom options:
Sync management
- Call
PocketSync.instance.start()
to start the sync process. - Call
PocketSync.instance.stop()
to stop the sync process. - Make sure to call
PocketSync.instance.setUserId(userId: 'user-123')
before starting the sync process. This is required to identify the user and track their changes.
Device id generation
PocketSync will automatically generate a unique device identifier for your app. This identifier is used to track changes made by the user on this device. There are some known limitations with device id generation on iOS:
- If the app is uninstalled and reinstalled, the device id will change.
- If the app is deleted and reinstalled, the device id will change.
- If the app is deleted and reinstalled, the device id will change.
Next Steps
- Learn about Core concepts
- Understand Conflict resolution