Flutter Mobile App Development¶
The Flutter app (apps/flutter) is a cross-platform mobile companion app that can target iOS, Android, and web platforms.
Prerequisites¶
| Tool | Version | Installation |
|---|---|---|
| Flutter | 3.x+ | flutter.dev/get-started |
| Xcode | 15+ | App Store (for iOS) |
| Android Studio | Latest | developer.android.com (for Android) |
Verify installation:
Project Setup¶
Running the App¶
iOS Simulator¶
-
Start the iOS Simulator or ensure a device is connected:
-
List available devices:
-
Run on a specific device:
Android Emulator¶
Web (Chrome)¶
macOS Desktop¶
Development Commands¶
| Command | Description |
|---|---|
flutter pub get |
Install dependencies |
flutter analyze |
Run static analysis |
flutter test |
Run unit tests |
flutter run |
Run in debug mode |
flutter run --release |
Run in release mode |
flutter build ios |
Build iOS app |
flutter build apk |
Build Android APK |
Project Structure¶
apps/flutter/
├── lib/
│ ├── main.dart # App entry point
│ ├── models/
│ │ └── session.dart # Data models
│ ├── screens/
│ │ ├── home_screen.dart # Main screen
│ │ └── settings_screen.dart # Settings
│ ├── services/
│ │ └── websocket_service.dart # WebSocket client
│ ├── theme/
│ │ └── terminal_theme.dart # Color theme
│ ├── utils/
│ │ └── ansi_parser.dart # ANSI escape code parser
│ └── widgets/
│ ├── prompt_bar.dart # Input bar
│ ├── session_tabs.dart # Session tabs
│ └── terminal_view.dart # Terminal display
├── test/ # Unit tests
├── ios/ # iOS-specific config
├── android/ # Android-specific config
├── macos/ # macOS-specific config
└── pubspec.yaml # Dependencies
Key Dependencies¶
| Package | Purpose |
|---|---|
provider |
State management |
web_socket_channel |
WebSocket communication |
shared_preferences |
Local storage |
xterm |
Terminal emulation |
Configuration¶
Server Address¶
The app connects to the tuiparser WebSocket server. Configure the server address in Settings.
Default: ws://localhost:9600/ws
For physical devices, use your machine's local IP address:
iOS Network Permissions¶
The app requires network access. Entitlements are configured in:
ios/Runner/DebugProfile.entitlementsios/Runner/Release.entitlements
Testing¶
Run all tests:
Run tests with coverage:
Troubleshooting¶
CocoaPods Issues¶
If you encounter CocoaPods errors:
Build Failures¶
Clean and rebuild:
Simulator Not Found¶
List available simulators:
Boot a simulator:
Comparison with Native iOS App¶
| Feature | Flutter App | Native iOS App |
|---|---|---|
| Platforms | iOS, Android, Web, macOS | iOS, iPadOS |
| Terminal | xterm package | SwiftTerm |
| Language | Dart | Swift |
| UI Framework | Flutter/Material | SwiftUI |
| Development | Hot reload | Xcode build |
Choose Flutter for cross-platform reach, or Native iOS for optimal SwiftTerm integration.