Expert assistant for the Barista GO Flutter app using GetX state management, Firebase Auth/Firestore backend, and feature-first architecture
Expert assistant for working with the Barista GO Flutter application - a mobile and desktop app using GetX for state management and routing, with Firebase (Auth + Firestore) as the backend.
1. **Create feature files** under `lib/features/<admin|customer|shared>/`
2. **Add controllers** alongside features with naming convention: `<feature>_controller.dart`
3. **Create services** in `lib/services/<domain>/` for backend logic
4. **Define routes** in `lib/utils/routes.dart`:
- Add route constant: `static const profile = '/profile';`
- Add GetPage entry: `GetPage(name: profile, page: () => const ProfilePage())`
5. **Register controllers** in `main.dart` using `Get.put(Controller())` for global availability, or use bindings/`Get.lazyPut` for page-scoped controllers
1. **Create service class** under `lib/services/<domain>/`
2. **Use FirebaseFirestore.instance** for database operations
3. **Follow existing error/logging patterns** (reference `CartService` as example)
4. **Check authentication** with `FirebaseAuth.instance.currentUser` - handle null cases
5. **Return models** from `lib/features/shared/model/`
6. **Follow Firestore patterns** - many collections are user-scoped (e.g., `cart/{userId}/coffee/{docId}`)
1. **App-wide state:** Use `ThemeController` pattern with SharedPreferences
2. **Initialize SharedPreferences:** Use `SharedPreferences.getInstance()`
3. **Handle exceptions** defensively, especially for web platform
4. **Use private keys** for preference storage
1. **Run tests:** `flutter test`
2. **Unit tests** for non-trivial logic (service conversions, calculations)
3. **Widget tests** for page-level UI (reference `test/widget_test.dart`)
4. **Mock authentication** - `FirebaseAuth.instance.currentUser` returns null in unauthenticated tests
5. **Test Firestore operations** with test users or mocks
```bash
flutter pub get
flutter run -d <device>
flutter test
flutter analyze
dart format .
flutter format .
```
1. **Small incremental changes** - one feature or service change per PR
2. **Follow existing patterns** - reference `CartService` and `ThemeController`
3. **Defensive coding** - handle exceptions and null cases
4. **Consistent naming** - `<feature>_controller.dart` for controllers
5. **Test coverage** - unit tests for logic, widget tests for UI
1. **Auth-dependent services** must check `FirebaseAuth.instance.currentUser`
2. **Firestore queries** assume specific document shapes defined in models
3. **Model changes** require updates to both services and UI
4. **SharedPreferences** can fail on web - always handle exceptions
5. **Platform support** - verify which platforms are actively supported before adding platform-specific code
**Adding a Route:**
```dart
// In lib/utils/routes.dart
class Routes {
static const profile = '/profile';
static final pages = [
GetPage(name: profile, page: () => const ProfilePage()),
];
}
```
**Creating a Service:**
```dart
// In lib/services/<domain>/my_service.dart
class MyService {
final FirebaseFirestore _firestore = FirebaseFirestore.instance;
Future<void> operation() async {
final userId = FirebaseAuth.instance.currentUser?.uid;
if (userId == null) throw Exception('Not authenticated');
// Follow CartService patterns for error handling
}
}
```
**Registering a Controller:**
```dart
// In main.dart for global controllers
Get.put(MyController());
// Or use bindings/lazyPut for page-scoped
Get.lazyPut(() => MyController());
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/barista-go-development-assistant/raw