Skip to main content

Prerequisites

Ditto’s Flutter Quickstart supports iOS, Android, and Web. Before getting started, ensure you have the following:
  • A code editor (Visual Studio Code is our recommendation, but any code editor will work)
  • Git installed on your machine
  • Flutter SDK 3.32 or later installed on your machine. The quickstart’s resolved Dart dependencies require Dart 3.8 or later.
  • A Ditto Portal account with a configured Ditto Database (see Getting SDK Connection Details)
  • Android Studio installed on your machine
  • A physical Android device or Android emulator
  • A macOS machine with Xcode 15 or later installed
  • A physical iOS device or iOS simulator
  • Please refer to the Flutter for Web guide for additional information on Ditto’s support for Flutter Web.

Get Started

1. Clone the Repository

  1. Open the terminal
  2. Clone the repository from GitHub.
  3. Navigate to the project directory:

2. Configure Ditto

In the Ditto Portal, open your database’s Connect via SDK tab and copy its Database ID, Development Token, and URL.

Add Ditto Credentials

From the quickstart directory, copy .env.sample into the Flutter app directory as .env, then set the values:

3. Run the Application

  1. Navigate to the Flutter demo directory.
  2. Install the necessary dependencies. This fetches all required packages from pubspec.yaml.
    The Android project uses Math.max(36, flutter.compileSdkVersion) for compileSdk; make Android SDK Platform 36 or the Flutter-selected higher platform available in Android Studio.
  3. Run the Application
  1. Ensure you have an Android Emulator running or connect a physical device
  2. Select the Android Emulator/Device
  1. Ensure you have an iOS Simulator running or connect a physical iOS device
  2. Select the iOS Simulator/Device
  1. Ensure you have Google Chrome installed
  2. Run the application in the web browser

4. Sync-Data Offline

  1. Launch the application on multiple devices or simulators
  2. Disconnect from your current WiFi network while keeping WiFi enabled on the device to allow for LAN connections
  3. Add, edit, and delete tasks and experience offline collaboration!
Please note that the web platform only supports syncing data with the Ditto cloud and does not support peer-to-peer sync

Next Steps

All the Ditto Quickstart apps work together! Try running a quickstart app in other languages and see them all collaborate.

Additional Resources