operator [] method

dynamic operator [](
  1. int i
)

Getter to access individual JrlLine entries in preparedLines by index. Replaces template variables in descriptions and evaluates expressions if any.

Implementation

operator [](int i) {
  JrlLine line = preparedLines[i]; // get
  //print("######     in line getter $line with ${line.valexp}");
  vars.forEach((key, value) {
    print("replacing : #$key with $value");
    line.desc = line.desc.replaceAll("#$key", "$value");
  });
  var evaled = eval(exp: line.valexp);
  if (evaled is int && evaled >= 0) line.valuta = evaled;
  return line;
}