Support for parsing a somewhat natural language expression into objects for use in Finance applications.
- Parse expressions with full numbers
12500 Milk and eggs - Parse expressions with shorthand
12.5k Milk and eggs - Supports expressions written with amount first (LTR) e.g.
1.5k Milk and eggs - Supports expressions written with description first (RTL) e.g.
Milk and eggs 1.5k - Supports formulas via formula parser for LTR expressions e.g.
300*5 Milk and eggs
Add to your pubspec.yaml
See examples in /example folder.
void main() {
print(Entry.parseLine("30k Sugar").amount);
print(Entry.parseLineRTL("Sugar 30k").amount);
// tryParse tries both LTR or RTL in one method call
print(Entry.tryParse("Sugar 30k").amount);
print(Entry.tryParse("30k Sugar").amount);
}The expression is parsed to an instance of the following class
class Entry {
final String id;
final String description;
final double amount;
final String opType;
}