Skip to content

Simplify flutter starter by removing build script #6

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

Merged
merged 4 commits into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions .env.example

This file was deleted.

33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,39 @@ Alternatively, open the repository URL in `Android Studio` to clone it directly.
## 🛠️ Development Guide

1. **Configure Appwrite**
Navigate to `lib/data/repository/appwrite_repository.dart` and update the values to match your
Appwrite project credentials.
Open `lib/config/environment.dart` and update the values with your Appwrite project credentials:
```dart
class Environment {
static const String appwriteEndpoint = '[appwriteEndpoint]';
static const String appwriteProjectId = '[appwriteProjectId]';
static const String appwriteProjectName = '[appwriteProjectName]';
}
```

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

3. **Run the App**
Select a target device (emulator or a connected physical device) in `Android Studio`, and
click **Run** to start the app.
Select a target device and run the app:
```bash
# List available devices
flutter devices

# Run on a specific device (replace 'device-id' with actual device)
flutter run -d device-id

# Examples:
flutter run -d chrome # Web
flutter run -d "iPhone 15" # iOS Simulator
flutter run -d emulator-5554 # Android Emulator
flutter run -d macos # macOS Desktop
```

**Build for Web:**
```bash
flutter build web
```

---

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

## 💡 Additional Notes

- This starter project is designed to streamline your Android development with Appwrite.
- This starter project is designed to streamline your Flutter development with Appwrite.
- Refer to the [Appwrite Documentation](https://appwrite.io/docs) for detailed integration guidance.
29 changes: 0 additions & 29 deletions build.sh

This file was deleted.

5 changes: 5 additions & 0 deletions lib/config/environment.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Environment {
static const String appwriteEndpoint = '[appwriteEndpoint]';
static const String appwriteProjectId = '[appwriteProjectId]';
static const String appwriteProjectName = '[appwriteProjectName]';
}
7 changes: 4 additions & 3 deletions lib/data/repository/appwrite_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import 'package:intl/intl.dart';
import 'package:appwrite/appwrite.dart';
import 'package:appwrite_flutter_starter_kit/data/models/log.dart';
import 'package:appwrite_flutter_starter_kit/data/models/project_info.dart';
import 'package:appwrite_flutter_starter_kit/config/environment.dart';

/// A repository responsible for handling network interactions with the Appwrite server.
///
/// It provides a helper method to ping the server.
class AppwriteRepository {
static const String pingPath = "/ping";
static const String appwriteProjectId = String.fromEnvironment('APPWRITE_PROJECT_ID');
static const String appwriteProjectName = String.fromEnvironment('APPWRITE_PROJECT_NAME');
static const String appwritePublicEndpoint = String.fromEnvironment('APPWRITE_PUBLIC_ENDPOINT');
static const String appwriteProjectId = Environment.appwriteProjectId;
static const String appwriteProjectName = Environment.appwriteProjectName;
static const String appwritePublicEndpoint = Environment.appwriteEndpoint;

final Client _client = Client()
.setProject(appwriteProjectId)
Expand Down
13 changes: 13 additions & 0 deletions prepare-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
set -e

# Script used during deployment on Appwrite Sites

# Replace [appwriteEndpoint] with APPWRITE_ENDPOINT in environment file
sed -i "s|\[appwriteEndpoint\]|$APPWRITE_ENDPOINT|g" lib/config/environment.dart

# Replace [appwriteProjectId] with APPWRITE_PROJECT_ID in environment file
sed -i "s|\[appwriteProjectId\]|$APPWRITE_PROJECT_ID|g" lib/config/environment.dart

# Replace [appwriteProjectName] with APPWRITE_PROJECT_NAME in environment file
sed -i "s|\[appwriteProjectName\]|$APPWRITE_PROJECT_NAME|g" lib/config/environment.dart