π This project is the base model of Zirel POS. If you want a ready-to-use, feature-complete POS app, you might want to check it out, it's free, no card required.
A Point of Sale (POS) application built with Flutter, demonstrating Clean Architecture principles and offline-first design patterns. This project serves as a learning resource and reference implementation for building Flutter apps with proper architecture and automatic data synchronization between local storage (SQLite) and cloud database (Firestore).
The app prioritizes local-first operations, storing all data in SQLite and automatically syncing with Firestore when online. When offline, all user actions (create, update, delete) are recorded as QueuedActions in the local database and automatically executed in sequence when internet connectivity is restored.
- Product Management: Full CRUD operations for products with image upload support
- Sales Transactions: POS interface with cart management and transaction history
- Thermal Receipt Printing: Print transaction receipts via USB, Bluetooth, BLE, or network printers with configurable paper sizes (58mm, 72mm, 80mm)
- User Authentication: Firebase Authentication with Google Sign-In integration
- Account Management: User profile management and settings
- Offline-First Architecture: Works seamlessly without internet connection
- Automatic Data Sync: SQLite β Firestore bidirectional synchronization
- Queued Actions: Automatic retry mechanism for offline operations (create, update, delete)
- Clean Architecture: Separation between presentation, domain, and data layers
- State Management: Riverpod (migrated from Provider) for safer, more testable state management
- Dependency Injection: Centralized DI setup for better code organization
- Unit Testing: Tests for datasources, repositories, and use cases
- Material Design 3: Material design 3 and Dark & Light theme switching support
- Customizable Theming: Adjustable colors and typography
- Multi-Platform: Supports Android, iOS, Windows, macOS, and Linux
- Error Handling: User-friendly error messages and states
- Reusable Widgets: Custom UI components for consistent design
flutter_pos/
βββ lib/
β βββ app/ # Application setup and configuration
β β βββ di/ # Dependency injection
β β βββ error/ # Error handling
β β βββ routes/ # App routing and navigation
β β
β βββ core/ # Core utilities and shared resources
β β βββ assets/ # Asset management
β β βββ common/ # Common utilities (Result wrapper)
β β βββ constants/ # App constants
β β βββ extensions/ # Dart extensions
β β βββ locale/ # Localization
β β βββ services/ # Core services
β β β βββ connectivity/ # Network connectivity checking
β β β βββ database/ # Local database service (sqflite)
β β β βββ info/ # Device info service
β β β βββ logger/ # Error logging service
β β β βββ printer/ # Thermal printer service
β β βββ themes/ # App theming (colors, sizes, themes)
β β βββ usecase/ # Base usecase interface
β β βββ utilities/ # Helper utilities (formatters, loggers, etc.)
β β
β βββ data/ # Data layer
β β βββ datasources/ # Data sources
β β β βββ interfaces/ # Datasource interfaces
β β β βββ local/ # Local datasources (sqflite)
β β β βββ remote/ # Remote datasources (Firestore, Firebase Auth)
β β βββ models/ # Data models with JSON serialization
β β βββ repositories/ # Repository implementations
β β
β βββ domain/ # Domain layer (Business logic)
β β βββ entities/ # Business entities
β β βββ repositories/ # Repository interfaces
β β βββ usecases/ # Use cases (business logic operations)
β β
β βββ presentation/ # Presentation layer (UI)
β β βββ providers/ # State management (Riverpod)
β β β βββ account/ # Account-related state
β β β βββ auth/ # Authentication state
β β β βββ home/ # Home screen state
β β β βββ main/ # Main navigation state
β β β βββ products/ # Products management state
β β β βββ theme/ # Theme state
β β β βββ transactions/ # Transactions state
β β βββ screens/ # UI screens
β β β βββ account/ # Account screens
β β β βββ auth/ # Authentication screens
β β β βββ error/ # Error screens
β β β βββ home/ # Home/POS screen
β β β βββ main/ # Main navigation screen
β β β βββ products/ # Product management screens
β β β βββ transactions/ # Transaction history screens
β β βββ widgets/ # Reusable UI components
β β
β βββ firebase_options.dart # Firebase configuration
β βββ main.dart # App entry point
β
βββ test/ # Unit and widget tests
β βββ core/services/ # Service tests
β βββ data/ # Data layer tests
β β βββ datasources/ # Datasource tests
β β βββ repositories/ # Repository tests
β βββ domain/usecases/ # Usecase tests
β βββ presentation/screens/ # Screen tests
β
βββ assets/ # Static assets
βββ android/ # Android platform files
βββ ios/ # iOS platform files
βββ linux/ # Linux platform files
βββ macos/ # macOS platform files
βββ web/ # Web platform files
βββ windows/ # Windows platform files
β
βββ analysis_options.yaml # Dart analyzer configuration
βββ pubspec.yaml # Package dependencies
βββ README.md # Project documentation
-
Clone the repository:
git clone https://github.com/elrizwiraswara/flutter_pos.git cd flutter_pos -
Install dependencies:
flutter pub get
-
Set up Firebase:
- Create a new project on Firebase.
- Follow the instructions to add Firebase to your Flutter app here.
- Enable google authentication provider
- Update cloud firestore rules to allow read write operation
service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.auth != null; } } }- Add cloud firestore indexes to enable query
- Update firebase storage rules to allow read write operation
service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { allow read, write: if request.auth != null; } } } -
Set up your
config.jsonfile
GOOGLE_SERVER_CLIENT_IDisWeb client IDthat you can get from your Firebase Google sign-in method provider{ "GOOGLE_SERVER_CLIENT_ID": "xxxxxxxxxxxxx.apps.googleusercontent.com" } -
Run the application:
flutter run --dart-define-from-file config.json
To test the application, run the following command:
flutter test --coverageTo view the test coverage you can use genhtml or test_cov_console
This project includes documentation files designed for AI coding agents (e.g., Claude Code) to keep code consistent when modifying the project:
CLAUDE.mdβ Project conventions (architecture, naming, code style)UI.mdβ UI reference (layouts, components, design specs)DATABASE.mdβ Database schema reference (tables, columns)WORKFLOW.mdβ Git workflow (commits, branches, PRs)
Contributions are welcome! Please open an issue or submit a pull request for any bugs, feature requests, or improvements.
This project is licensed under the MIT License - see the LICENSE file for details.





