after dart --fix
This commit is contained in:
parent
29208f8c40
commit
19fd9552c8
4 changed files with 8 additions and 12 deletions
11
README.md
11
README.md
|
|
@ -33,15 +33,14 @@ The file is a dart array of formulas. Each formula is a dart set literal
|
|||
|
||||
},
|
||||
{
|
||||
"name": 'Test argument order',
|
||||
"name": 'Triangle rectangle',
|
||||
"input": [
|
||||
'z':{ "magnitude": 'scalar'},
|
||||
'a':{ "magnitude": 'scalar'},
|
||||
'y':{ "magnitude": 'scalar'},
|
||||
'b':{ "magnitude": 'meter'},
|
||||
'c':{ "magnitude": 'meter'},
|
||||
],
|
||||
"output": { 'result', "magnitude": 'scalar' },
|
||||
"output": { 'a': { "magnitude": 'meter' } },
|
||||
"d4rtCode": '''
|
||||
result = a * 100 + y * 10 + z;
|
||||
a = Math.sqrt(b*b + c*c);
|
||||
''',
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class UnitCorpus {
|
|||
void loadUnits(List<UnitSpec> units, [bool replaceOnDuplicates = false]) {
|
||||
for (final unit in units) {
|
||||
if (!replaceOnDuplicates && _allUnits.containsKey(unit.name)) {
|
||||
throw ArgumentError("Duplicate unit:${unit}");
|
||||
throw ArgumentError("Duplicate unit:$unit");
|
||||
}
|
||||
_allUnits[unit.name] = unit;
|
||||
_baseToUnits[unit.baseUnit]?.add(unit.name);
|
||||
|
|
@ -38,7 +38,7 @@ class UnitCorpus {
|
|||
|
||||
UnitSpec operator [](String unit) {
|
||||
if (!_allUnits.containsKey(unit)) {
|
||||
throw ArgumentError("Unit not found:${unit}");
|
||||
throw ArgumentError("Unit not found:$unit");
|
||||
}
|
||||
return _allUnits.get(unit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ class UnitSpec {
|
|||
final String? codeFromUnitToBase;
|
||||
final String? codeFromBaseToUnit;
|
||||
|
||||
static final BASEUNIT="BASEUNIT";
|
||||
|
||||
UnitSpec({
|
||||
required this.name,
|
||||
required this.baseUnit,
|
||||
|
|
@ -49,7 +47,7 @@ class UnitSpec {
|
|||
String symbol = SetUtils.stringValue(theSet, "symbol");
|
||||
|
||||
if( theSet.containsKey("isBase") ){
|
||||
return UnitSpec(name: name, baseUnit: BASEUNIT, symbol: symbol, factorFromUnitToBase: 1);
|
||||
return UnitSpec(name: name, baseUnit: name, symbol: symbol, factorFromUnitToBase: 1);
|
||||
}
|
||||
|
||||
String baseUnit = SetUtils.stringValue(theSet, "baseUnit");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:d4rt_formulas/corpus.dart';
|
||||
import 'package:d4rt_formulas/formula_evaluator.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:d4rt_formulas/formula_models.dart';
|
||||
import 'dart:convert' show utf8;
|
||||
|
|
|
|||
Loading…
Reference in a new issue