Flutter
Flutter Quick Start
Welcome to the Flutter Quick Start Guide! This guide will help you clone, set up, and run the Ditto Demo Flutter Application from a public GitHub repository.
By the end of this quick start, you will have successfully run the Ditto Task Application on either iOS, Android, or both, and will be able to sync data without needing an internet connection.
Prerequisites
- Installed code editor (preferably Visual Studio Code or Android Studio)
- Flutter SDK installed on your machine
- Git installed on your machine
- Ditto Portal account with a Ditto Application (see Getting Playground Token Credentials)
For Android development:
- Android Studio installed on your machine
- A physical Android device or Android emulator
For iOS development:
- macOS with the latest version of Xcode installed
- A physical iOS device or iOS simulator
1. Clone the Repository
- Clone the repository from GitHub. Open a terminal and run the following command:
git clone
- Navigate to the project directory:
2. Install Dependencies
- Install the necessary dependencies.
This command will fetch all the dependencies listed in the pubspec.yaml
file.
3. Configure Ditto
Obtain App ID and Playground Token
- Log in to your Ditto Portal account
- Navigate to your application and obtain the App ID and Playground Token (see Getting Playground Token Credentials for more details)
Update Flutter Application with Ditto Credentials
- Open the
lib/main.dart
file or the appropriate configuration file where Ditto is initialized - Update the code with the App ID and Playground Token from your Ditto Application
Dart
4. Run the Application
Run the Application on Android
- Ensure you have an Android Emulator running or connect a physical device
- Run the following command in the terminal from the root of the application
- Select the Android Emulator/Device
[1]: sdk gphone64 arm64 (emulator-1234) [2]: Mac Designed for iPad (mac-designed-for-ipad)
Please choose one (or “q” to quit):
Run the Application on iOS
- Ensure you have an iOS Simulator running or connect a physical iOS device
- Run the following command in the terminal and select the iOS Simulator/Device
- Select the iOS Simulator/Device
[1]: iPhone 15 (5A8DFE9D-7BF0-4BEE-A675-A056B64CEE3F) [2]: Mac Designed for iPad (mac-designed-for-ipad)
Please choose one (or “q” to quit):
5. Sync-Data Offline
- Launch the application on multiple devices, emulators, or simulators
- Disconnect from your current WiFi network while keeping WiFi enabled on the device to allow for LAN connections
- Note: Android Emulators and iOS Simulators can only form offline connections with each other due to platform limitations
- Create new Tasks and update the Done status of existing tasks
Was this page helpful?