Overview
EvalEx is a lightweight Dart package that evaluates mathematical and boolean expressions at runtime. It supports basic arithmetic, parentheses, variables, and common functions like sin, cos, and log. Originally ported from a JavaScript library, it provides a simple API for parsing and computing expressions safely. Ideal for applications requiring dynamic formula evaluation, such as calculators, financial tools, or configuration-based logic. The package runs across all major platforms including mobile, web, and desktop.
Use cases
- Dynamic formula calculation
- Calculator apps
- Configuration-based logic
- Financial modeling
- Data validation
- Scientific computations
Key features
- Supports arithmetic and boolean expressions
- Variable substitution
- Built-in mathematical functions
- Safe expression parsing
- Cross-platform compatibility
- Simple API with minimal setup
Suitable for
- Developers building calculators
- Applications needing runtime expression evaluation
- Educational tools
- Backend logic with user-defined formulas
- Prototyping dynamic calculations
Considerations
- Not suitable for highly complex or performance-critical math
- No support for custom function definitions
- Expressions must be syntactically valid
- Limited to basic operations and standard functions
- Security caution with untrusted input