Skip to main content

Connectors

A CRDTDocument lives in memory. The connectors put it to work: they keep it on disk, send it to the other peers, and show it on screen. Each one is a package of its own, and each one only follows the document, so you can add them one at a time.

ConnectorWhat it doesStart here
Replicaopens the document, its storage and its sync client together, in the right orderOpen a replica
Persistencereads the document back on launch, and writes down every changePersistence
Flutterrebuilds widgets when the document changes; text fields and editorsFlutter
Syncsends changes to other peers over WebSocket, with a server or a relaySync

In an app that needs both storage and sync, start from the replica: it is one call, and it keeps the order that makes the app work offline. The recipes show the connectors already wired together.