Skip to content

Commit 8aa2aec

Browse files
authored
Merge pull request #6 from appwrite/fix-build-script
Simplify flutter starter by removing build script
2 parents 774da7a + 8e2361b commit 8aa2aec

File tree

6 files changed

+50
-40
lines changed

6 files changed

+50
-40
lines changed

.env.example

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,39 @@ 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
28-
Appwrite project credentials.
27+
Open `lib/config/environment.dart` and update the values with your Appwrite project credentials:
28+
```dart
29+
class Environment {
30+
static const String appwriteEndpoint = '[appwriteEndpoint]';
31+
static const String appwriteProjectId = '[appwriteProjectId]';
32+
static const String appwriteProjectName = '[appwriteProjectName]';
33+
}
34+
```
2935

3036
2. **Customize as Needed**
3137
Modify the starter kit to suit your app's requirements. Adjust UI, features, or backend
3238
integrations as per your needs.
3339

3440
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.
41+
Select a target device and run the app:
42+
```bash
43+
# List available devices
44+
flutter devices
45+
46+
# Run on a specific device (replace 'device-id' with actual device)
47+
flutter run -d device-id
48+
49+
# Examples:
50+
flutter run -d chrome # Web
51+
flutter run -d "iPhone 15" # iOS Simulator
52+
flutter run -d emulator-5554 # Android Emulator
53+
flutter run -d macos # macOS Desktop
54+
```
55+
56+
**Build for Web:**
57+
```bash
58+
flutter build web
59+
```
3760

3861
---
3962

@@ -46,5 +69,5 @@ production : https://docs.flutter.dev/deployment
4669

4770
## 💡 Additional Notes
4871

49-
- This starter project is designed to streamline your Android development with Appwrite.
72+
- This starter project is designed to streamline your Flutter development with Appwrite.
5073
- Refer to the [Appwrite Documentation](https://appwrite.io/docs) for detailed integration guidance.

build.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

lib/config/environment.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Environment {
2+
static const String appwriteEndpoint = '[appwriteEndpoint]';
3+
static const String appwriteProjectId = '[appwriteProjectId]';
4+
static const String appwriteProjectName = '[appwriteProjectName]';
5+
}

lib/data/repository/appwrite_repository.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import 'package:intl/intl.dart';
22
import 'package:appwrite/appwrite.dart';
33
import 'package:appwrite_flutter_starter_kit/data/models/log.dart';
44
import 'package:appwrite_flutter_starter_kit/data/models/project_info.dart';
5+
import 'package:appwrite_flutter_starter_kit/config/environment.dart';
56

67
/// A repository responsible for handling network interactions with the Appwrite server.
78
///
89
/// It provides a helper method to ping the server.
910
class AppwriteRepository {
1011
static const String pingPath = "/ping";
11-
static const String appwriteProjectId = String.fromEnvironment('APPWRITE_PROJECT_ID');
12-
static const String appwriteProjectName = String.fromEnvironment('APPWRITE_PROJECT_NAME');
13-
static const String appwritePublicEndpoint = String.fromEnvironment('APPWRITE_PUBLIC_ENDPOINT');
12+
static const String appwriteProjectId = Environment.appwriteProjectId;
13+
static const String appwriteProjectName = Environment.appwriteProjectName;
14+
static const String appwritePublicEndpoint = Environment.appwriteEndpoint;
1415

1516
final Client _client = Client()
1617
.setProject(appwriteProjectId)

prepare-env.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Script used during deployment on Appwrite Sites
5+
6+
# Replace [appwriteEndpoint] with APPWRITE_ENDPOINT in environment file
7+
sed -i "s|\[appwriteEndpoint\]|$APPWRITE_ENDPOINT|g" lib/config/environment.dart
8+
9+
# Replace [appwriteProjectId] with APPWRITE_PROJECT_ID in environment file
10+
sed -i "s|\[appwriteProjectId\]|$APPWRITE_PROJECT_ID|g" lib/config/environment.dart
11+
12+
# Replace [appwriteProjectName] with APPWRITE_PROJECT_NAME in environment file
13+
sed -i "s|\[appwriteProjectName\]|$APPWRITE_PROJECT_NAME|g" lib/config/environment.dart

0 commit comments

Comments
 (0)