Flutter demo guide and download
A runnable Flutter example app that demonstrates sign-in, conversations, messages, friends, groups, profiles, channels and more, as a reference for your own integration. It uses SDK version 1.0.0-alpha.3; the example app's own version number is managed separately from the SDK's.
Download the Flutter demo ZIP · Download the SHA256 list
After unzipping, go into deeprespond-im-flutter-demo-1.0.0-alpha.3 and run sha256sum -c SHA256SUMS to check the files. On Windows, check the ZIP against the SHA256 list above with PowerShell's Get-FileHash -Algorithm SHA256 <ZIP file>.
Get it and project layout
- The downloaded ZIP: run it from the package root after unzipping; dependencies come from pub.dev (the dependency on the repository workspace has been removed).
- The full repository: run
flutter pub getinsdk/flutterfirst, then go intoexample. Theexamplein the repository depends on the workspace, so don't copy it out to run on its own. - The ZIP includes the example app, the Android / iOS / macOS / Linux platform projects, tests and instructions. It doesn't include the SDK source,
local.properties, build caches or the IM server.
| Directory | Responsibility |
|---|---|
| lib/main.dart | Client, entry point, events and call routing |
| lib/pages | Sign-in, conversations, messages, friends, groups, profile and channels |
| lib/fixtures.dart | Test mode: a separate temporary data directory, simulated network loss and test attachments |
| integration_test | End-to-end tests against a real server, with screenshots |
| android, ios, macos, linux | Platform projects |
Environment and platforms
Flutter 3.38.1 or later and Dart 3.10 or later. Run flutter doctor -v and flutter devices first.
| Platform | Requirements and limits |
|---|---|
| Android | Android SDK, JDK 17; test emulators and real devices separately |
| iOS / macOS | A Mac with Xcode, signing and permissions configured; needs an actual build and test on a Mac |
| Linux | clang, CMake, Ninja, pkg-config, GTK 3 development libraries and a desktop environment; IM features have end-to-end test records, but there's no audio/video (LiveKit doesn't support Linux) |
| Windows | The SDK supports the Windows desktop, but the demo has no Windows project; you need to create and test one yourself, it won't run straight from the ZIP |
Seeing the call entry doesn't mean audio/video, the system incoming-call UI or background capture have been tested. Vendor push needs real devices and vendor accounts.
Run
From the package root, or from example in a repository with the workspace installed:
flutter pub get
flutter devices
flutter run -d <设备ID> \
--dart-define=IM_APP_KEY='组织#应用' \
--dart-define=IM_API_URL='https://im.example.com'- In PowerShell, join the command into one line.
- These two parameters are compile-time
--dart-defines; setting environment variables with the same names has no effect. You can also change the service URL and AppKey on the sign-in page. - The default
http://127.0.0.1:18480and AppKeydemo#demoare only local placeholders. - Turn on password sign-in, registration, friends and audio/video policies in the console as needed. The Client Secret and App Token stay on the server.
- To test two users, use two devices, or give each of two processes its own data directory (don't share one), add each other as friends and test; sign out before switching users.
- Microphone, camera, photo library and notification permissions, and Firebase / APNs / vendor push configuration, are up to your app.
- The API, attachment and audio/video addresses all need to be reachable from the device.
Local testing
Running a local IM test service on your development machine needs the full IM repository (the ZIP doesn't include the server). From the repository root:
make infra-up
go build -o /tmp/flutter-demo-harness ./sdk/conformance/harness
/tmp/flutter-demo-harness -env .env -addr 127.0.0.1:18480 -control 127.0.0.1:18490 \
-db im_flutter_demo -redis-prefix flutter-demo:- If a port is taken, use a free one and update the demo's configuration to match. The test service's
GET /envreturns the test AppKey; never put server credentials into the app. - When running the Linux / macOS version on the same computer,
127.0.0.1works directly. On Android,127.0.0.1is the device itself, so forward the API, LiveKit and object storage ports withadb reverse, or use an HTTPS address the device can reach. - Check network and certificates on each device. Don't let several tests change the same test app's policies at once.
Test mode and verification
flutter run -d linux --dart-define=IM_DEMO_FIXTURES=trueTest mode (IM_DEMO_FIXTURES=true) uses a new temporary data directory every time and adds buttons on the "Me" page to simulate network loss and send a test image, file or long text. It still connects to the real service; it's not an offline fake backend.
From the full repository root you can run make sdk-flutter-test and make sdk-flutter-integration; the latter needs the local test service running first. In sdk/flutter/example, run the end-to-end tests with screenshots against a real server:
IM_HARNESS=http://127.0.0.1:18490 IM_E2E_SHOTS=/tmp/flutter-demo-shots \
flutter test integration_test/e2e_test.dart -d linux \
--dart-define=IM_DEMO_FIXTURES=true --dart-define=IM_VIEWPORT=desktopLinux without a desktop environment also needs Xvfb. So far there are only test records for 27 scenarios on Linux (see Agent测试/Flutter_SDK_Demo完善/测试报告.md in the full repository); that doesn't mean other platforms or audio/video have passed.
Troubleshooting
| Symptom | Check |
|---|---|
| Workspace root not found | In the repository, run flutter pub get in sdk/flutter first; to run on its own, use the downloaded ZIP |
| Version mismatch | Flutter / Dart versions, access to pub.dev and the deeprespond_* version constraints; don't follow the old 2.0.0 instructions |
| Android SDK not found | Configure the path on your own computer; the package doesn't ship local.properties |
| sqlite3 incompatible on Linux | Check glibc and the native library requirements; the full repository is configured to use the system SQLite, so configure your own app for your system |
| Sign-in fails | AppKey, account, policies, ticket and service URL; you can change the service configuration on the sign-in page |
| Images or calls fail | Whether the device can reach the returned attachment and audio/video addresses, ports and permissions |
| No call button on Linux | Linux doesn't support LiveKit; test audio/video on another platform |
| No Windows project | The demo has no Windows project; create and test one yourself |
| Push doesn't arrive | Firebase / APNs / vendor configuration, credential IDs in the console, notification permission and system restrictions |
For platform configuration, see the Quickstart, Offline push and Audio and video calls.
