Skip to content

Commit fcc2384

Browse files
committed
Fix build script for flutter
1 parent 774da7a commit fcc2384

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,15 @@ Alternatively, open the repository URL in `Android Studio` to clone it directly.
2424
## 🛠️ Development Guide
2525

2626
1. **Configure Appwrite**
27-
Navigate to `lib/data/repository/appwrite_repository.dart` and update the values to match your
27+
Copy `.env.example` to `.env` and update the values to match your
2828
Appwrite project credentials.
2929

3030
2. **Customize as Needed**
3131
Modify the starter kit to suit your app's requirements. Adjust UI, features, or backend
3232
integrations as per your needs.
3333

3434
3. **Run the App**
35-
Select a target device (emulator or a connected physical device) in `Android Studio`, and
36-
click **Run** to start the app.
35+
Run by executing `./build.sh {device-name}` like `./build.sh chrome`
3736

3837
---
3938

build.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,27 @@ if [ ! -f .env ]; then
1010
fi
1111

1212
# Read .env file and convert it to --dart-define arguments
13-
ARGS=""
13+
ARGS=()
1414
while IFS='=' read -r key value || [ -n "$key" ]; do
1515
# Ignore empty lines and comments
1616
if [[ -n "$key" && ! "$key" =~ ^# ]]; then
17-
ARGS+=" --dart-define=${key}=\"${value}\""
17+
ARGS+=("--dart-define=${key}=${value}")
1818
fi
1919
done < .env
2020

21-
# Build Flutter web
22-
eval flutter build web "$ARGS"
23-
24-
# If --preview flag is provided, run a local preview server
25-
if [ "$1" == "--preview" ]; then
26-
echo "Starting preview server at http://localhost:3000..."
27-
cd build/web || exit 1
28-
python3 -m http.server 3000
21+
# Check if device parameter is provided
22+
if [ -z "$1" ]; then
23+
echo "Usage: ./build.sh <device_id_or_name>"
24+
echo "Example: ./build.sh chrome"
25+
echo "Example: ./build.sh 'iPhone 15'"
26+
echo ""
27+
echo "Available devices:"
28+
flutter devices
29+
exit 1
2930
fi
31+
32+
DEVICE_NAME="$1"
33+
34+
# Run Flutter app on specified device
35+
echo "Running Flutter app on device: $DEVICE_NAME"
36+
flutter run -d "$DEVICE_NAME" "${ARGS[@]}"

0 commit comments

Comments
 (0)