Skip to content

Commit 9453e45

Browse files
committed
Simplify flutter starter
1 parent c0cae9f commit 9453e45

File tree

6 files changed

+50
-42
lines changed

6 files changed

+50
-42
lines changed

.env.example

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

README.md

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

2626
1. **Configure Appwrite**
27-
Copy `.env.example` to `.env` 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 = 'appwrite-endpoint';
31+
static const String appwriteProjectId = 'your-project-id';
32+
static const String appwriteProjectName = 'your-project-name';
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-
Run by executing `./build.sh {device-name}` like `./build.sh chrome`
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+
```
3660

3761
---
3862

@@ -45,5 +69,5 @@ production : https://docs.flutter.dev/deployment
4569

4670
## 💡 Additional Notes
4771

48-
- 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.
4973
- Refer to the [Appwrite Documentation](https://appwrite.io/docs) for detailed integration guidance.

build.sh

Lines changed: 0 additions & 32 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 = 'appwrite-endpoint';
3+
static const String appwriteProjectId = 'appwrite-project-id';
4+
static const String appwriteProjectName = 'appwrite-project-name';
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 environments files
7+
sed -i "s|appwrite-endpoint|$APPWRITE_ENDPOINT|g" lib/config/environment.dart
8+
9+
# Replace [appwriteProjectId] with APPWRITE_PROJECT_ID in environments files
10+
sed -i "s|appwrite-project-id|$APPWRITE_PROJECT_ID|g" lib/config/environment.dart
11+
12+
# Replace [appwriteProjectName] with APPWRITE_PROJECT_NAME in environments files
13+
sed -i "s|appwrite-project-name|$APPWRITE_PROJECT_NAME|g" lib/config/environment.dart

0 commit comments

Comments
 (0)