This directory contains the Flutter-based native wrapper for CodeDroid, specifically optimized for Android devices. It packages the reactive Leptos Rust WebAssembly frontend into a high-performance Android application shell.
Web browsers have strict security constraints regarding the file:// protocol. Specifically:
- WebAssembly Loading: Modern web browsers block loading and compiling WebAssembly binary streams from
file://assets due to MIME type and CORS restrictions. - Persistence: Features like LocalStorage, session storage, and cookies require a valid origin (HTTP/HTTPS) to be persisted between launches.
To solve this, the Flutter client implements InAppLocalhostServer. It spins up a secure, local HTTP server (http://localhost:8080) directly on the device background thread to serve the frontend assets with correct MIME types (application/wasm, etc.) offline.
- Seamless Dark Theme: Styled with a premium dark theme (
#181818background,#228DF2blue accents) that matches the CodeDroid editor perfectly, eliminating safe-area/notch borders. - Native System UI Overlay: Configured transparent status bars and matching navigation bars for a fully immersive, edge-to-edge coding workspace.
- Automatic File Picker: Handled natively using the system file browser wrapper so you can upload or select files in your project directories.
- Persistent LocalStorage & Cache: DOM storage, Web SQL database, and custom caching configurations are fully enabled.
- LSP Local Host Routing: Built-in network permission profiles allow connection to system compilers and LSP backend servers running on localhost ports (e.g.
http://localhost:3000).
Before running or building the app, make sure you have the following installed:
- Flutter SDK (v3.10 or higher recommended)
- Android SDK (configured with command line tools and emulator/physical device debugging enabled)
Ensure the latest build of codedroid_frontend is synced into the Flutter project's assets:
# From the root directory of the CodeDroid workspace
./apps/sync_assets.sh./build_api.sh && ./apps/sync_assets.shStart the app on your connected device/emulator:
cd apps/flutter_android
flutter runGenerate an optimized, standalone release bundle:
flutter build apk --releaseThe compiled APK will be located at:
build/app/outputs/flutter-apk/app-release.apk
lib/main.dart: Entry point. Launches the localhost server, configures theThemeData, and embeds the customInAppWebViewcontainer.android/app/src/main/AndroidManifest.xml: Configures standard internet, hardware acceleration, and cleartext traffic privileges to enable local backend API loopbacks.pubspec.yaml: Declares dependencies such asflutter_inappwebviewand asset mapping paths.