toString method
String
toString({
- String indent = "",
- bool debug = false,
- bool recursive = false,
- dynamic empty = false,
- bool extracts = false,
override
create a String representation of this object, eventually by recursing through the sub accounts below this one .
Implementation
@override
String toString(
{String indent = "",
bool debug = false,
bool recursive = false,
empty = false,
bool extracts = false}) {
String result = "";
if (extracts) {
//print("trying to add '${extract.toString()}'");
if (empty)
result += extract.toString();
else if (extract.journal.length > 0) {
result += extract.toString() + "\n";
//String pff= extract.toString();
//if(pff.isNotEmpty) { print("adding ### $pff ####");result += pff;}
//else print("rejecting $pff");
}
} else {
var f = NumberFormat.currency(symbol: cur2sym(cur));
double valAsd = valuta / 100;
double budAsd = budget / 100;
String pname = (name == "no name") ? "$number" : name;
result = (debug)
? "$indent$number. +$pname+ -$desc- ,=$cur=, '$budget' #$valuta#\n"
: (recursive && !empty && desc.length <= 0)
? ""
: "$indent${sprintf("%#4s", [pname])} ${sprintf("%-49s", [
desc
])} ${sprintf("%12s", [
f.format(budAsd)
])} ${sprintf("%12s", [f.format(valAsd)])}\n";
}
;
if (recursive) {
//var f = NumberFormat("###,###,###.00");
//result += (desc.length >0 || empty)?"##$empty\n":"";
children.forEach((key, kto) {
//result += kto.toString(indent:indent+"$number"); //debug, just to check depth
String sres = kto.toString(
indent: indent + " ",
recursive: true,
debug: debug,
empty: empty,
extracts: extracts);
if (sres.trim().isNotEmpty) result += "$sres";
});
}
//print("extracted +$ktoName+ -$desc- ,=$w=, '$budget' #$valuta#\n");
return (result);
}