Agriculture-focused Flutter application that digitises soil testing, crop advisory and agri-service delivery for Farmers, Agents & Admins. Built end-to-end by [Your Name] – Solo Flutter Engineer.
- Real-world complexity: multi-role app with secure login, e-commerce–style shop/cart/checkout, orders & payments, plus agronomy workflows.
- Enterprise-grade architecture: Clean Architecture, feature-first modules, SOLID principles, CI-ready.
- Production readiness: flavour-based builds, error handling, token refresh, offline cache, analytics hooks, theming & localisation scaffolds.
Once you clone the repository you can watch a short walkthrough of the main user flows:
<!-- GitHub renders the HTML <video> tag, providing in-page playback -->
<video src="assets/demo1.mp4" controls style="max-width: 100%; height: auto;">
Your browser does not support the <code>video</code> tag.
</video><!-- GitHub renders the HTML <video> tag, providing in-page playback -->
<video src="assets/demo2.mp4" controls style="max-width: 100%; height: auto;">
Your browser does not support the <code>video</code> tag.
</video>| Layer | Technology | Why |
|---|---|---|
| UI & Routing | Flutter 3.22, go_router | Declarative navigation, deep links, guards |
| State | flutter_bloc (complex flows), Riverpod (DI/light state) | Clear separation of concerns, testability |
| Networking | dio + interceptors (Token, Refresh) | Fine-grained HTTP control, retry, logging |
| Local Storage | isar | High-performance NoSQL, offline cache |
| Secure Storage | flutter_secure_storage | Persist JWT & refresh tokens |
| Functional utils | fpdart | Either<Failure, T> for errors |
| CI ready | GitHub Actions (template included) | Automated format → analyse → test → build |
All packages pinned in
pubspec.yamlfor reproducible builds.
Clean Architecture with feature slicing:
lib/
app/ ← App-level config (router, themes, injections)
core/ ← Cross-cutting concerns (exceptions, failure, utils)
features/
auth/
data/ • domain/ • presentation/
products/
cart/
checkout/
orders/ ← scaffolded (API pending)
common/ ← Reusable widgets, extensions, providers
UI (Bloc / Riverpod Consumer)
│ events / state
▼
UseCase ←–– functional wrapper (Either<Failure,T>)
│
▼
Repository (abstract in domain → impl in data)
│
├── RemoteDataSource (Dio) ↔ API / JSON
└── LocalDataSource (Isar) ↔ Device DB
/splash → /login → /home (ShellRoute)
├─ /dashboard
├─ /shop
│ └─ /shop/product/:productId
├─ /cart
└─ /profile
Auth guard redirects unauthenticated users to /login and prevents back-navigation to splash.
# Get packages
flutter pub get
# Run Dev flavour
flutter run --flavor dev -t lib/main_dev.dart
# Run Prod flavour (release)
flutter run --flavor prod -t lib/main_prod.dart --releaseVS Code users:
.vscode/launch.jsonalready contains launch configs Bhoomi Sakti (Dev/Prod/Profile).
# .env.dev
API_BASE_URL=https://dev.api.example.com
# ...
Loaded at start-up via flutter_dotenv (hooked in main_*.dart).
- Unit tests for use-cases, repositories, blocs (100% deterministic via mocks).
- Widget tests for critical flows (login, add-to-cart, checkout).
- very_good_analysis + dart format enforced in CI.
- GitHub Actions: on PR –
flutter pub get,flutter test --coverage,dart analyze,flutter build apk --debug.
Badge templates included – add your own secrets to enable.
- Token refresh race-condition: implemented
RefreshInterceptorthat queues failed 401 requests until a new token arrives, eliminating double refresh calls. - Offline cart: Cart items cached in Isar; queued mutations sync when connectivity restores (Connectivity + Stream listen).
- UseCase abstraction:
UseCasevsFutureUseCasesplit surfaced a bug (async mis-match) – fixed inRefreshTokenUsecase, improving compile-time safety. - Composable routing: Nested
StatefulShellRouteallows independent nav stacks per bottom-tab while preserving global auth redirects. - Scalable DI: Riverpod providers (e.g.,
cartBlocProvider) make BLoCs mockable in tests and hot-swappable (e.g., switching to StateNotifier for trivial flows).
- Finish Orders module (design skeleton already present) once backend endpoints are finalised.
- Integrate Firebase Crashlytics & Sentry for release monitoring.
- Add Melos workspace + code-gen for freezed models to streamline data layer.
- Implement e2e tests with
flutter_driver/integration_test.
Satendra Pal
Feel free to fork, open issues, or reach out if you have questions!