Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter web hot restart #105

Merged
merged 4 commits into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions docs/labs/flutter-web-hot-restart.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ To overcome this limitation, you can use the following bash script to monitor fi
1. **Copy and Paste the Bash Script**
Copy the following script into a file (for example, `hot_reload.sh`).

`#!/bin/bash
```
#!/bin/bash

# Path to your Flutter project directory
PROJECT_DIR="/home/project/hello_world_web/lib"
Expand Down Expand Up @@ -66,7 +67,8 @@ To overcome this limitation, you can use the following bash script to monitor fi
start_server

# Start watching for changes
watch_and_reload`
watch_and_reload
```

2. **Set the Correct Project Directory**
In the script, make sure to update the line that sets `PROJECT_DIR` to point to your Flutter project directory.
Expand All @@ -76,8 +78,10 @@ To overcome this limitation, you can use the following bash script to monitor fi
3. **Run the Script**
After saving the script, give it execute permissions and run it:

`chmod +x hot_reload.sh
./hot_reload.sh`
```
chmod +x hot_reload.sh
./hot_reload.sh
```

The script will start the Flutter web server, and any time you modify a file in your project, it will detect the change, rebuild the project, and restart the server automatically.

Expand Down