KhataBook is a comprehensive financial transaction tracking application built with Flutter. It allows users to manage customers and suppliers, track credit and debit transactions, and generate detailed transaction reports in PDF format.
- Frontend Framework: Flutter
- Programming Language: Dart
- Database: SQLite (using sqflite plugin), Firebase
- State Management: Provider
- PDF Generation: pdf package
- Contact Selection: flutter_contacts
- File Operations: path_provider, open_file, flutter_file_dialog
- Date Formatting: intl
- Add customers and suppliers from device contacts
- Search contacts by name
- Display contacts with balance information
- View detailed transaction history for each contact
- Record "You Gave" (debit) transactions
- Record "You Got" (credit) transactions
- Add transaction notes/descriptions
- View transaction history with date and time
- Dashboard with summary statistics:
- Total amount you will give
- Total amount you will get
- QR collections (if applicable)
- Transaction-based balance calculation
- Real-time balance updates
- Generate PDF transaction reports for specific contacts
- Share and save PDF reports
- Make direct calls to contacts from the application
- Clean, intuitive UI inspired by modern financial apps
- Color-coded transaction history (red for debit, green for credit)
- Search and filter functionality
- Responsive design for various device sizes
The application uses the Provider pattern for state management, offering several benefits:
- Centralized Data: All data management is handled through the KhataBookProvider class
- Reactive UI: UI components automatically update when the underlying data changes
- Code Organization: Clear separation between data logic and UI components
- Efficient Updates: Only the affected parts of the UI rebuild when data changes
Key state management components:
- KhataBookProvider: Manages contacts, transactions, and overall application state
- DatabaseHelper: Handles all database operations for persistent storage
- Transaction models: Structured data models with clear typing and validation
The application uses a SQLite database with two main tables:
- id (Primary Key)
- name
- phone
- type ('customer' or 'supplier')
- notes
- created_at
- id (Primary Key)
- contact_id (Foreign Key to Contacts)
- amount
- type ('credit' or 'debit')
- description
- date
- created_at



