Last active
November 12, 2025 02:54
-
-
Save Ajinkgupta/dd45476b5de754b6ed3a9ddba9edb33f to your computer and use it in GitHub Desktop.
Flutter Web Setup for the Github Codespaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # setup_flutter_web.sh — Setup Flutter Web in GitHub Codespaces | |
| set -euo pipefail | |
| PROJECT_DIR="${1:-.}" | |
| FLUTTER_INSTALL_DIR="/usr/local/flutter" | |
| FLUTTER_CHANNEL="stable" | |
| WEB_PORT=8080 | |
| WEB_HOST="0.0.0.0" | |
| echo "=== Installing dependencies ===" | |
| sudo apt-get update -y | |
| sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa openjdk-17-jdk ca-certificates | |
| echo "=== Cloning Flutter SDK (stable channel) ===" | |
| if [ ! -d "$FLUTTER_INSTALL_DIR" ]; then | |
| sudo git clone https://github.com/flutter/flutter.git -b $FLUTTER_CHANNEL $FLUTTER_INSTALL_DIR | |
| else | |
| echo "Flutter already installed at $FLUTTER_INSTALL_DIR" | |
| fi | |
| echo "=== Adding Flutter to PATH ===" | |
| export PATH="$PATH:$FLUTTER_INSTALL_DIR/bin" | |
| echo "=== Checking Flutter doctor ===" | |
| flutter doctor -v || true | |
| echo "=== Enabling Flutter Web ===" | |
| flutter config --enable-web | |
| echo "=== Running flutter pub get ===" | |
| cd "$PROJECT_DIR" | |
| flutter pub get | |
| echo "✅ Setup complete!" | |
| echo "" | |
| echo "Run your app with:" | |
| echo "flutter run -d web-server --web-hostname=0.0.0.0 --web-port=8080" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment