Mobile App Setup
This guide will help you set up the ThePlugg mobile app for development.
Prerequisites
- Flutter SDK (latest stable version)
- Dart SDK (comes with Flutter)
- Xcode (for iOS development on macOS)
- Android Studio (for Android development)
- Physical device or emulator/simulator
Installation
- Install Flutter
Follow the official Flutter installation guide: https://flutter.dev/docs/get-started/install
Verify installation:
flutter doctor
- Clone and navigate to project
cd ThePlugg-app
- Get dependencies
flutter pub get
- Configure API endpoint
Edit lib/config/api_config.dart and update the base URL:
static const String baseUrl = 'http://localhost:3000';
// or production: 'https://api.thepluggnamibia.com'
- Configure Firebase (if using)
The app uses Firebase for:
- Authentication
- Push notifications (via OneSignal)
Set up Firebase projects for iOS and Android and add configuration files:
ios/Runner/GoogleService-Info.plist(iOS)android/app/google-services.json(Android)
- iOS Setup
cd ios
pod install
cd ..
- Run the app
# List available devices
flutter devices
# Run on iOS
flutter run -d ios
# Run on Android
flutter run -d android
Environment Configuration
The app uses hardcoded configuration in lib/config/api_config.dart. For different environments, you can:
- Create environment-specific config files
- Use environment variables
- Use build flavors
Testing
Run tests:
flutter test
Building
iOS
flutter build ios
Android
flutter build apk
# or for app bundle
flutter build appbundle
Troubleshooting
iOS Issues
- Run
pod installinios/directory - Clean build:
flutter clean && flutter pub get - Check Xcode version compatibility
Android Issues
- Check Android SDK installation
- Verify
android/local.propertieshas correct SDK path - Clean build:
flutter clean && flutter pub get
Common Errors
- Missing dependencies: Run
flutter pub get - Build errors: Run
flutter cleanand rebuild - API connection: Check network and API endpoint configuration