Get Started with Numix
This guide will take you from installation to using Numix’s powerful calculation features in just a few minutes. By the end, you’ll have the app running and understand how to use each calculator.Before starting, make sure you’ve completed the Installation guide and have Flutter SDK 3.6.0 or higher installed.
Launch Numix
Start an Emulator or Connect a Device
Launch an Android emulator, iOS simulator, or connect a physical device:
- Android Emulator
- iOS Simulator
- Physical Device
Run the Application
Launch Numix on your connected device:The app will compile and install on your device. This may take a minute or two on the first run.
For faster subsequent runs, use hot reload (press
r in the terminal) or hot restart (press R) during development.Welcome to Numix!
Once launched, you’ll see the Numix welcome screen, followed by the home page displaying four main features:
- Calculadora de Descuentos (Discount Calculator)
- Calculadora Precios Venta (Sales Price Calculator)
- Inventario de Productos (Product Inventory)
- Historial de Ventas (Sales History)
Explore the Features
Home Page Navigation
The Numix home page provides quick access to all features. Here’s what the main navigation looks like:lib/features/home/screens/home_page.dart
Using the Discount Calculator
Navigate to Discount Calculator
From the home page, tap on “Calculadora de Descuentos” (Discount Calculator).
Select Discount Type
Choose between two discount calculation modes:
- Percentage: Apply discounts as percentages (e.g., 20% off)
- Fixed Amount: Apply discounts as fixed monetary amounts (e.g., $50 off)
Enter Values
Fill in the required fields:
- Original Price: The starting price before discounts
- Primary Discount: The first discount to apply
- Additional Discount (optional): A second discount applied sequentially
- Tax (optional): Tax percentage to add to the final price
Discounts are applied sequentially. For percentage discounts, the additional discount is calculated on the price after the primary discount.
Discount Calculator Logic
Here’s how the discount calculator handles percentage-based discounts:lib/features/discount_calculator/providers/discount_provider.dart
Using the Sales Price Calculator
Navigate to Sales Price Calculator
From the home page, tap on “Calculadora Precios Venta” (Sales Price Calculator).
Choose Calculation Method
Select between two profit calculation methods:
- Markup: Calculate price by adding a percentage profit to the cost
- Formula:
Sale Price = Cost + (Cost × Profit %) - Example: 150 sale price
- Formula:
- Margin: Calculate price from desired profit margin on selling price
- Formula:
Sale Price = Cost ÷ (1 - Margin %) - Example: 150 sale price
- Formula:
Enter Values
Fill in the calculator fields:
- Cost: The cost price of the product
- Profit Percentage: Desired profit as a percentage (markup or margin)
- Tax (optional): Tax percentage to add to the final price
Sales Price Calculation Logic
The calculator handles both markup and margin calculations:lib/features/sales_price_calculator/providers/sales_price_provider.dart
Understanding the Architecture
State Management with Provider
Numix uses theprovider package for state management. Here’s how the app is structured:
lib/main.dart
- MultiProvider: Exposes multiple providers to the entire widget tree
- ChangeNotifierProvider: Creates and provides state management classes
- SharedPreferences: Enables data persistence across app restarts
Your calculator inputs are automatically saved using
shared_preferences. When you reopen the app, your last calculations will be restored.Feature-First Structure
Each feature in Numix is self-contained:- Isolation: Features don’t depend on each other
- Maintainability: Easy to locate and modify code
- Testability: Business logic is separated from UI
- Scalability: New features can be added without affecting existing ones
Key Features at a Glance
Discount Calculator
- Dual discount types (percentage/fixed)
- Sequential multi-tier discounts
- Automatic tax calculation
- Input validation and error handling
Sales Price Calculator
- Markup and margin calculations
- Profit amount visibility
- Tax integration
- Real-time calculation updates
Product Inventory
- Product tracking
- Quantity management
- Organized interface
- Quick access to product data
Sales History
- Transaction logging
- Historical data access
- Analysis and reporting
- Persistent storage
Data Persistence
All your work in Numix is automatically saved. Here’s how persistence works:lib/features/discount_calculator/providers/discount_provider.dart
Testing Your Setup
Verify everything is working correctly:Test Discount Calculator
Enter these values in the Discount Calculator:
- Original Price: 100
- Primary Discount: 20 (percentage)
- Additional Discount: 10 (percentage)
- Tax: 5
- After first discount: 20)
- After second discount: 8 more)
- Tax: $3.60
- Final Price: $75.60
Test Sales Price Calculator
Enter these values in the Sales Price Calculator (Markup mode):
- Cost: 50
- Profit Percentage: 100
- Tax: 10
- Base Sale Price: $100
- Profit: $50
- Tax: $10
- Final Price: $110
Development Tips
Hot Reload and Hot Restart
Hot Reload and Hot Restart
During development, Flutter provides two powerful features:
- Hot Reload (press
r): Updates the UI instantly while preserving app state - Hot Restart (press
R): Restarts the app while maintaining the connection
Theme Switching
Theme Switching
Numix supports both light and dark themes. The theme toggle is available in the app bar:Test your UI in both themes to ensure good visibility and aesthetics.
Error Handling
Error Handling
Numix has comprehensive error handling. Try entering invalid values to see how errors are displayed:
- Negative numbers
- Percentages over 100%
- Non-numeric characters
- Empty required fields
Running Tests
Running Tests
Numix includes a comprehensive test suite. Run tests to verify calculations:The project enforces 100% test coverage for all mathematical calculation logic.
Next Steps
Now that you have Numix running, here are some things to explore:Explore the Architecture
Dive deeper into the domain-driven feature-first architecture and understand how features are isolated
Review the Code
Examine the provider implementations to understand the business logic and state management patterns
Run Tests
Execute the test suite to see how mathematical calculations are validated
Customize the Theme
Modify the Material 3 theme in
main.dart to match your brand colorsTroubleshooting
App won't start
App won't start
- Ensure a device is connected:
flutter devices - Clean the build:
flutter clean && flutter pub get - Restart the device/emulator
- Run with verbose logging:
flutter run -v
Calculations not persisting
Calculations not persisting
- Check SharedPreferences initialization in
main.dart - Verify you’re waiting for async initialization:
- Check device storage permissions
Provider not found errors
Provider not found errors
Ensure providers are properly registered in
main.dart:Get Help
If you encounter issues not covered in this guide:- Check the project’s AI ecosystem documentation in
.ai/directory - Review the
AGENTS.mdfile for architectural guidelines - Run
flutter doctorto verify your development environment - Check the test suite for examples of correct usage
Congratulations! You now have Numix running and understand its core features. Start exploring the calculators and experience the power of professional commercial math calculations.