balanced property
Transaction
balanced
Implementation
Transaction get balanced => (() {
if (isBalanced) return this;
if (!canBeBalanced) return this;
final blankPosting = postings.firstWhere((p) => p.position == null);
return copyWith(
postings: [
...postings.where((p) => p.position != null).map((p) => p.balance(date)),
...sumsMap.values.where((money) => !money.isZero).map(
(money) => blankPosting.copyWith(
position: Position(unit: -money).balance(date),
),
),
],
);
})();