How onkardighe/biozen works
Project type and purpose
• This is a cross-platform Flutter application (“BioZen”) targeting Android, iOS, Web, Windows, macOS, and Linux.
• Its domain is a biofuels supply-chain tracker built on Ethereum. The client app (Flutter UI + Dart code) interacts with smart contracts via an ABI (assets/abi.json).
• No separate “backend” repo; the blockchain node (Infura or self-hosted) serves as the data layer, with optional Google/Firebase services for OTP and analytics.
File structure
• Top level:
• android/, ios/, web/, windows/, macos/, linux/ — platform embedding and build configs
• lib/ — Flutter/Dart source:
– lib/pages/ — all UI screens (Login, Dashboard, NewSupply, etc.)
– lib/utils/ — business logic, helper classes, theme, constants
– lib/Contracts/ — smart-contract wrapper classes
• assets/abi.json — Ethereum contract ABI
• pubspec.yaml — declares dependencies (likely includes web3dart, http, flutter_localizations, etc.)
• test/ — widget_test.dart
• Each platform folder contains native build files: Gradle (android), Xcode & CocoaPods (ios, macos), CMake (linux, windows).
READMEs for further insights
• README.md confirms Ethereum integration and shows UI snapshots.
• supplychain/README.md (not shown here) probably lists dependencies (web3dart, flutter_otp, provider/state management).
Main components
a. Client App (Flutter)
• UI Layer: pages/widgets in lib/pages
• Business-Logic Layer: service classes in lib/utils and lib/Contracts
• Persistence: local storage (shared_preferences or SQLite, if used)
• Platform Integration: Android (Gradle, Google-services.json), iOS (CocoaPods), Desktop (CMake)
b. Blockchain Backend
• Ethereum Node Provider (Infura or self-hosted Geth/Parity)
• Smart Contracts (deployed on Ethereum mainnet/testnet)
• ABI Interface (assets/abi.json)
c. External Services
• OTP/email provider (Firebase Auth? Twilio)
• Analytics/crash reporting (Firebase Crashlytics / Google Analytics)
d. Development & CI
• Unit/Widget Tests (test/widget_test.dart)
• Deployment pipelines (GitHub Actions / fastlane for Android & iOS)
Relationships & data flow
• UI Layer → Business Logic → Web3dart → Ethereum Node
• UI Layer ← Events from Blockchain (tx receipts, events)
• UI Layer ↔ External Auth Service (login, OTP)
• Local storage used for caching session or config
Architectural patterns & design principles
• Layered architecture (UI, Service, Data)
• Separation of concerns: UI code in pages/, logic in utils/, contract wrappers in Contracts/
• Cross-platform abstraction via Flutter Engine
• Single source of truth for smart-contract interactions