Welcome to the Flutter SDK Installation Guide. This document provides step-by-step instructions for installing and configuring the Ditto SDK, enabling you to sync, query, and insert data seamlessly within your existing Flutter application.
1.9.20
or later
./android/settings.gradle
org.jetbrains.kotlin.android
plugin to 1.9.20
ios/Runner/Info.plist
:android/app/src/main/AndroidManifest.xml
.android/app/src/main/AndroidManifest.xml
. Then edit the service metadata appropriately.small_app_icon
drawable must be monochrome white.The foreground service will be automatically started and stopped on startSync()
and stopSync()
, respectively.appID
, playground token
, authURL
, and websocketURL
for your application. These are required to initialize the Ditto SDK.Ditto
. This is the main entry point into all Ditto-related functionality.items
:
insertData
function wherever appropriate in your application, such as in a button press handler.
items
collection:
observeData
function, typically in the initState
method of a stateful widget to start observing when the widget is initialized.
dispose()
method to prevent resource leaks
startSync
. This enables this device to sync data with other peers including the Ditto Cloud.
items
collection:
syncData
function, typically when initializing your Ditto instance.
await Ditto.init()
. By default, assets are bundled with the application and loaded
from the same web server that serves the application. After running flutter build web
, you can find those in the
build/web/assets/packages/ditto_live/lib/assets
directory.
Alternatively, you can host the contents of that directory on a CDN or other web
server and configure Ditto to load assets from there. All contents of the
directory, excluding the ditto.wasm
file itself, must be reachable at the URL
given by the wasmShimUrl
parameter. The ditto.wasm
file can be served from a
separate URL given by the wasmUrl
parameter.
Configuration for loading all assets from a CDN: