Skip to main content

Overview

To sync with your backend, implement the SyncApiClient interface. This guide shows how to create a production-ready implementation.

Interface

Basic Implementation

Configuration

In your bootstrap.dart:

Error Handling

Retry Logic

The sync service automatically retries failed operations. Handle these error types:

Testing

Use the StubSyncApiClient for testing:

Best Practices

  1. Always return SyncResult - Don’t throw exceptions
  2. Handle auth errors - Don’t retry 401s
  3. Validate before sending - Catch 422s early
  4. Network errors - Let the sync service retry
  5. Log everything - Helpful for debugging