isar_sync 0.1.0-dev.3 copy "isar_sync: ^0.1.0-dev.3" to clipboard
isar_sync: ^0.1.0-dev.3 copied to clipboard

Offline-first, event-sourced sync for Isar apps: capture local changes and converge them across devices through pluggable cloud adapters (Drive, iCloud).

example/README.md

isar_sync examples #

Runnable snippets that show how to wire the core pipeline.

  • basic.dart — a minimal end-to-end cycle (capture → queue → push → pull → apply) against an in-memory demo adapter.
  • isar_collection_mapping_template.dart — template for mapping Isar collections to a CollectionMappedSyncStore.

Run the basic example:

dart run example/basic.dart

Minimal usage #

import 'package:isar_sync/isar_sync.dart';

const deviceId = 'device-A';

final queue = InMemorySyncQueue();
final core = SyncCore(
  queue: queue,
  adapter: myAdapter, // GoogleDriveSyncAdapter or ICloudSyncAdapter
  applyEngine: DefaultApplyEngine(
    store: InMemorySyncStore(),
    conflictResolver: const LastWriteWinsConflictResolver(),
    localDeviceId: deviceId,
  ),
  cursorStore: InMemorySyncCursorStore(),
);

final capture = QueueBackedChangeCapture(queue: queue, deviceId: deviceId);
await capture.capture(
  SyncMutation(
    collection: 'notes',
    entityId: 'n1',
    operation: SyncOperation.upsert,
    payload: {
      'title': 'hello',
      'updatedAt': DateTime.now().toUtc().toIso8601String(),
    },
  ),
);

final report = await core.syncOnce();
print('pushed=${report.pushedCount}, pulled=${report.pulledCount}');

See the package README and doc/usage.md for the full guide.

0
likes
160
points
12
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Offline-first, event-sourced sync for Isar apps: capture local changes and converge them across devices through pluggable cloud adapters (Drive, iCloud).

Repository (GitHub)
View/report issues
Contributing

Topics

#isar #flutter #sync #offline-first #drive

License

MIT (license)

Dependencies

googleapis, http, meta, path

More

Packages that depend on isar_sync