Developer Guide¶
Welcome to the ShopSync Developer Guide! This section provides comprehensive technical documentation for developers who want to contribute to or understand the ShopSync codebase.
Overview¶
ShopSync is built with:
- Flutter - Cross-platform UI framework
- Firebase - Backend services (Auth, Firestore)
- Provider - State management
- Material Design 3 - UI components
Quick Links¶
- Architecture
Understand the app's structure and design patterns
- Project Structure
Navigate the codebase organization
- State Management
Learn how ShopSync manages app state
- Firebase Integration
Deep dive into Firebase services
- Services
Core services and utilities
- Screens
UI screens and navigation
- Widgets
Reusable UI components
- Testing
Testing strategies and guidelines
Getting Started¶
Prerequisites¶
- Flutter SDK (^3.6.0)
- Dart SDK (^3.0.0)
- Firebase project configured
- IDE (Android Studio or VS Code)
Setup¶
- Clone the repository
- Run
flutter pub get - Configure Firebase
- Run
flutter run
See Installation Guide for detailed steps.
Architecture Overview¶
ShopSync follows clean architecture principles:
lib/
├── main.dart # App entry point
├── screens/ # UI screens
├── widgets/ # Reusable widgets
├── services/ # Business logic
├── models/ # Data models
├── utils/ # Utilities
└── l10n/ # Localizations
Key Concepts¶
Offline-First¶
ShopSync is designed to work offline:
- Local data persistence
- Sync queue management
- Conflict resolution
- Background synchronization
Real-time Collaboration¶
Multiple users can edit simultaneously:
- Firestore real-time listeners
- Optimistic UI updates
- Automatic conflict resolution
State Management¶
Provider pattern for state:
ChangeNotifierfor reactive stateConsumerwidgets for UI updates- Scoped providers for feature isolation
Development Workflow¶
Branch Strategy¶
main- Production-ready codedevelop- Integration branchfeature/*- New featuresbugfix/*- Bug fixesrelease/*- Release preparation
Code Style¶
Follow Dart/Flutter style guidelines:
- Use
flutter format - Follow naming conventions
- Document public APIs
- Write meaningful commit messages
Testing¶
Write tests for:
- Unit tests for services
- Widget tests for UI components
- Integration tests for user flows
CI/CD¶
Automated pipelines:
- Linting and formatting checks
- Unit and widget tests
- Build verification
- Deployment to stores
Contributing¶
We welcome contributions! See:
API Reference¶
Core Services¶
SharedPrefs- Local storage wrapperGoogleAuth- Authentication serviceConnectivityService- Network statusMigrationService- Data migrationThemeNotifier- Theme management
See Services Documentation for details.
Firebase Services¶
- Firebase Auth - User authentication
- Cloud Firestore - Real-time database
- Firebase Storage - File storage (future)
- Cloud Functions - Server-side logic (future)
Resources¶
Common Tasks¶
Adding a New Screen¶
- Create file in
lib/screens/ - Define StatefulWidget
- Add route in
main.dart - Implement UI
- Add navigation
Adding a New Service¶
- Create file in
lib/services/ - Define service class
- Implement methods
- Add to providers (if stateful)
- Document API
Adding Dependencies¶
- Add to
pubspec.yaml - Run
flutter pub get - Import where needed
- Update documentation
Debugging¶
Common Issues¶
Build Failures:
- Run
flutter clean - Delete
pubspec.lock - Run
flutter pub get
Firebase Issues:
- Verify configuration files
- Check security rules
- Review console logs
State Issues:
- Check provider scope
- Verify notifyListeners() calls
- Use Flutter DevTools
Next Steps¶
Ready to dive deeper?
Questions? Open an issue on GitHub.