Prerequisites, installation, build options, rig configuration, and secure credential storage.
- Prerequisites
- Installation
- Running the App
- Building for Release
- Rig Configuration
- Build-Time Overrides (--dart-define)
- Secure Credential Storage
- Node.js Server Setup
- Template vs App
| Tool | Version | Purpose | Install |
|---|---|---|---|
| Flutter SDK | ≥ 3.0.0 | App framework | flutter.dev/get-started |
| Dart SDK | ≥ 3.0.0 | Language (bundled with Flutter) | Included in Flutter |
| Git | Any | Version control | brew install git / apt install git |
| Android Studio | Any | Android SDK + emulator | developer.android.com |
| VS Code (optional) | Any | Editor with Flutter extension | code.visualstudio.com |
| JDK | 17 | Android builds | brew install openjdk@17 |
| Node.js | ≥ 18 (optional) | Companion server | nodejs.org |
Verify your environment:
flutter doctor -vAll checks should pass (or show only iOS-related warnings on non-macOS systems).
# Clone the repository
git clone https://github.com/<your-username>/LGFlutterStarterKit.git
cd LGFlutterStarterKit
# Install Flutter dependencies
cd flutter_client
flutter pub getdart format --set-exit-if-changed .
flutter analyze --no-fatal-infosBoth commands should exit with code 0 (zero warnings, zero errors).
cd flutter_client
flutter runThe app launches with:
- Splash Screen — 2-second branding display
- Connection Screen — Enter rig IP, port, username, password
- Click "Connect" to establish SSH connection, or "Skip (Demo Mode)" to explore the UI without a rig
# List available devices
flutter devices
# Run on specific device
flutter run -d <device-id>flutter build apk --debugOutput: build/app/outputs/flutter-apk/app-debug.apk
flutter build apk --release --split-per-abiOutput: build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk (and arm64, x86_64)
flutter build apk --release --split-per-abi \
--dart-define=LG_HOST=10.0.0.5 \
--dart-define=LG_PORT=22 \
--dart-define=LG_USER=myuser \
--dart-define=LG_PASSWORD=mypassAll connection and rig constants are centralized in flutter_client/lib/config.dart:
class Config {
// Connection (overrideable via --dart-define)
static const String lgHost = String.fromEnvironment('LG_HOST', defaultValue: '192.168.56.101');
static const int lgPort = int.fromEnvironment('LG_PORT', defaultValue: 22);
static const String lgUser = String.fromEnvironment('LG_USER', defaultValue: 'lg');
static const String lgPassword = String.fromEnvironment('LG_PASSWORD', defaultValue: 'lg');
// Rig geometry
static const int totalScreens = 3; // 3, 5, or 7
static const int masterScreen = 1;
static int get leftScreen => totalScreens; // Logo screen
static int get rightScreen => 2;
// Home city (Task 2: Fly to Home City)
static const double homeCityLat = 41.6176; // Lleida, Spain
static const double homeCityLng = 0.6200;
static const String homeCityName = 'Lleida';
// App metadata
static const String appName = 'LG Flutter Starter Kit';
static const String appVersion = '1.0.0';
// Server
static const String serverUrl = 'http://localhost:3000';
// Timeouts
static const int connectionTimeout = 10; // seconds
static const int kmlRefreshInterval = 2; // seconds
}- Change the IP: Update
defaultValueinlgHostor use--dart-define=LG_HOST=your.ip - Change screen count: Set
totalScreensto5or7— logo placement and slave numbering adapt automatically - Change home city: Update
homeCityLat,homeCityLng, andhomeCityNameto your city's coordinates
All four connection parameters support compile-time overrides via --dart-define. This allows building APKs for different rigs without modifying any source code.
| Flag | Config Field | Default |
|---|---|---|
--dart-define=LG_HOST=x |
Config.lgHost |
192.168.56.101 |
--dart-define=LG_PORT=x |
Config.lgPort |
22 |
--dart-define=LG_USER=x |
Config.lgUser |
lg |
--dart-define=LG_PASSWORD=x |
Config.lgPassword |
lg |
Config uses String.fromEnvironment() and int.fromEnvironment() which are resolved at compile time by the Dart compiler:
static const String lgHost = String.fromEnvironment('LG_HOST', defaultValue: '192.168.56.101');If --dart-define=LG_HOST=10.0.0.5 is passed during build, lgHost becomes '10.0.0.5'. Otherwise, it uses the default.
The flutter-build.yml workflow accepts a lg_host input and passes it to the build:
- run: flutter build apk --debug --dart-define=LG_HOST=${{ inputs.lg_host }}| Data | Storage Backend | Encrypted? | Access |
|---|---|---|---|
| Host IP | SharedPreferences |
No | settings.host |
| Port | SharedPreferences |
No | settings.port |
| Screen Count | SharedPreferences |
No | settings.totalScreens |
| Username | FlutterSecureStorage |
Yes (AES-256) | settings.username |
| Password | FlutterSecureStorage |
Yes (AES-256) | settings.password |
| Theme Mode | SharedPreferences |
No | themeProvider.themeMode |
- On app start:
SettingsProvider._loadSettings()reads credentials from secure storage - Connection Screen pre-fills text fields with stored values
- On connect:
SettingsProvider.updateSettings()saves credentials beforeLGService.connect() - On reset:
SettingsProvider.resetToDefaults()clears both secure and shared storage
- Android: AES-256 with keys stored in the Android Keystore
- iOS: Values stored in the iOS Keychain
- Package:
flutter_secure_storage ^9.0.0
- Passwords and API keys must use
FlutterSecureStorage— neverSharedPreferences - The
lg-shieldagent skill scans for violations of this rule - No secrets should appear in source code, config files, or version control
The companion server is optional — the Flutter app works independently via SSH.
cd server
npm install
npm startDefault port: 3000 (configurable via PORT environment variable)
# Custom port
PORT=8080 npm start
# Development mode (auto-reload)
npm run devVerify: curl http://localhost:3000/health
This repository is a template — it intentionally does not contain platform-specific directories.
| Directory | In Template? | Generated When? |
|---|---|---|
android/ |
❌ No | flutter create . in demo app |
ios/ |
❌ No | flutter create . in demo app |
web/ |
❌ No | flutter create . in demo app |
linux/ |
❌ No | flutter create . in demo app |
macos/ |
❌ No | flutter create . in demo app |
windows/ |
❌ No | flutter create . in demo app |
test/ |
❌ No | flutter create . in demo app |
The Antigravity lg-init skill generates a new app from this template and runs flutter create . to produce platform directories. Do not run flutter create in this repository.