Skip to content

Repository files navigation

My Formula Calculator 🧪

Flutter Version Dart Version State Management ObjectBox Platform

Note

A robust, cross-platform mathematical calculator designed for users who need more than just arithmetic. Create, save, and evaluate custom formulas with variables and constants, all stored securely on your device.


🎨 Overview

My Formula Calculator is built with Clean Architecture and a Feature-First approach. It allows users to define their own mathematical models, perform complex calculations with ease, and maintain a history of their work. This app is 100% offline-first, ensuring your data is always available without needing an internet connection.


✨ Key Features

  • 🧠 Custom Formula Engine

    • Define variables, constants, and complex expressions.
    • Support for trigonometric, logarithmic, and standard functions via math_expressions.
    • Built-in validation to prevent syntax errors during formula creation.
  • 📴 Offline-First Storage

    • Powered by ObjectBox: High-performance NoSQL database for Flutter.
    • Lightning-fast local persistence for formulas and history.
    • zero-latency data access.
  • 📤 Data Portability (Import/Export)

    • Backup your entire library to JSON files.
    • Restore formulas across devices or share them with others.
    • Automatic duplicate handling with "(Copy)" suffixing.
  • 📅 Calculation History

    • Track every calculation with detailed logs of inputs used and outputs generated.
    • Easily re-run or reference past computations.
  • 💻 Multi-Platform Excellence

    • Native performance on Android.
    • Optimized Windows desktop experience.
  • 🌓 Premium UI/UX

    • Modern Material 3 design system.
    • Dynamic theme switching (Light, Dark, and System).
    • Clean, intuitive interface powered by GoRouter.

🛠️ Technology Stack

Layer Technology Purpose
Framework Flutter 3.x Multi-platform UI development
Logic BLoC / Cubit Predictable state management
Database ObjectBox Primary offline-first storage
DI Injectable / Get_It Scalable dependency management
Routing GoRouter Declarative navigation
Math eval_ex High-performance evaluation engine
Persistence Shared Preferences User settings and theme state

🏗️ Architecture

This project follows Feature-First Clean Architecture, ensuring high maintainability and testability.

graph TD
    subgraph Presentation
        UI[Widgets/Pages] --> B[BLoC / Cubit]
    end
    
    subgraph Domain
        B --> UC[Use Cases]
        UC --> E[Entities]
        UC --> RI[Repository Interfaces]
    end
    
    subgraph Data
        RI -.-> RP[Repository Implementations]
        RP --> DS[Data Sources - ObjectBox/Local]
    end
    
    style Presentation fill:#e1f5fe,stroke:#01579b
    style Domain fill:#e8f5e9,stroke:#1b5e20
    style Data fill:#fff3e0,stroke:#e65100
Loading

Folder Structure

lib/
├── core/               # App-wide utilities, themes, and global constants
│   ├── database/       # ObjectBox Store setup
│   ├── math/           # Formula evaluation logic
│   ├── router/         # GoRouter definitions
│   └── di/             # Dependency injection setup
├── features/           # Independent feature modules
│   ├── formula/        # Core formula domain & data layers
│   ├── formula_editor/ # Formula creation UI
│   ├── formula_calculator/ # Evaluation UI
│   ├── history/        # History tracking
│   └── settings/       # User preferences
└── main.dart           # Entry point & app configuration

🚀 Getting Started

Prerequisites

  • Flutter SDK: ^3.11.1

Development Setup

  1. Clone & Fetch

    git clone https://github.com/Kheemwel/my_formula_calculator.git
    cd my_formula_calculator
    flutter pub get
  2. Code Generation This project heavily relies on objectbox_generator, freezed, and injectable. Generate the boilerplate using:

    flutter pub run build_runner build --delete-conflicting-outputs
  3. Run

    flutter run

🧪 Testing

We follow a strict TDD (Test-Driven Development) workflow.

  • Unit Tests: Logic and BLoCs are tested using mocktail and bloc_test.
  • Integration Tests: E2E flows are located in integration_test/.

Run all tests:

flutter test

About

A robust, cross-platform mathematical calculator designed for users who need more than just arithmetic. Create, save, and evaluate custom formulas with variables and constants, all stored securely on your device.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages