Prerequisites
Before starting, ensure you have the required tools installed:- Flutter SDK 3.27.0 or later
- Dart SDK 3.0.0 or later
- Android Studio (for Android builds)
- Xcode (for iOS builds, macOS only)
- Git for version control
Install Flutter
Follow the official Flutter installation guide for your platform:- macOS
- Linux
- Windows
Verify Installation
- Flutter (Channel stable)
- Android toolchain
- Xcode (macOS only)
- VS Code or Android Studio
Clone the Repository
Clone the Sure repository and navigate to the mobile directory:Development Setup
Install Dependencies
Install all Flutter packages defined in For iOS development, also install CocoaPods dependencies:
pubspec.yaml:Generate App Icons
Generate platform-specific app icons from the source image:This creates icons for iOS and Android based on
assets/icon/app_icon.png.This step is required before building the app locally.
Configure Backend URL
Edit The address
lib/services/api_config.dart to point to your Sure backend server:- Android Emulator
- iOS Simulator
- Physical Device
- Production
10.0.2.2 is a special alias to the host machine’s localhost.Building for Release
Android Builds
Build APK
Generate an APK file for direct installation:Output location:
build/app/outputs/flutter-apk/app-release.apkiOS Builds
Build iOS Release
This creates an unsigned build. For App Store distribution, you’ll need to sign the build in Xcode.
mobile/docs/iOS_BUILD.md in the repository.
CI/CD Configuration
The mobile app includes automated builds via GitHub Actions:Workflow Triggers
- Push to
mainbranch (when Flutter files change) - Pull requests to
mainbranch - Tags matching
mobile-release-*(triggers TestFlight upload)
Build Pipeline
The workflow (.github/workflows/flutter-build.yml) performs:
- Code Analysis:
flutter analyze - Tests:
flutter test - Android Builds:
- Release APK
- Release App Bundle (AAB)
- iOS Build: Unsigned release build
- Artifact Upload: Build outputs uploaded as artifacts
TestFlight Distribution
When a mobile release is tagged,.github/workflows/ios-testflight.yml runs to:
- Build signed iOS release
- Archive and export IPA
- Upload to App Store Connect
- Submit for TestFlight beta testing
Required secrets for TestFlight:
APPLE_ID, APP_STORE_CONNECT_API_KEY, MATCH_PASSWORD, etc. See mobile/docs/iOS_TESTFLIGHT.md for complete setup.Download Build Artifacts
After a successful CI run:- Go to the Actions tab on GitHub
- Select the workflow run
- Download artifacts:
app-release-apk- Android APKapp-release-aab- Android App Bundleios-build-unsigned- iOS app (requires signing)
Development Environment
Recommended IDE Setup
Android Studio
- Full Flutter support via plugin
- Built-in Android emulator
- Device manager and debugging tools
- Install Flutter and Dart plugins
VS Code
- Lightweight and fast
- Excellent Flutter extension
- Integrated terminal and debugging
- Install Flutter and Dart extensions
Enable Hot Reload
When running in debug mode, use hot reload to see changes instantly:- Press
rin the terminal to hot reload - Press
Rto hot restart - Press
hfor help
Debugging Tips
View Logs
Clear App Data
- Android
- iOS Simulator
Network Debugging
To inspect API requests:- Use Flutter DevTools:
flutter pub global run devtools - Enable network logging in
lib/services/*_service.dart - Use Android Studio’s Network Profiler
Configuration Files
pubspec.yaml
Defines app metadata and dependencies:API Configuration
lib/services/api_config.dart manages backend connectivity:
Troubleshooting
Common Issues
Flutter command not found
Flutter command not found
Add Flutter to your PATH:Then reload your shell or run
source ~/.bashrc.CocoaPods installation fails (iOS)
CocoaPods installation fails (iOS)
Update CocoaPods:Clear cache and retry:
Android build fails with Gradle errors
Android build fails with Gradle errors
Clean and rebuild:
Cannot connect to backend on Android emulator
Cannot connect to backend on Android emulator
Ensure you’re using Verify your backend is running:
10.0.2.2 instead of localhost:App icon not showing
App icon not showing
Regenerate icons:
Next Steps
Once your development environment is set up:- Review the Authentication Guide to understand the auth flow
- Explore the codebase structure in
lib/ - Check existing screens in
lib/screens/ - Review API services in
lib/services/ - Customize the app for your needs