stringify property

String stringify

Implementation

String get stringify => (() {
      final buffer = StringBuffer()..write(unit);

      if (cost != null) {
        if (isAbsoluteCost) {
          final cost2Print = cost!.copyWith(
            value: cost!.value?.multiplyByFixed(unit.amount),
          );
          buffer.write(' {{${cost2Print.stringify}}}');
        } else {
          buffer.write(' {${cost!.stringify}}');
        }
      }

      if (price != null) {
        if (isAbsolutePrice) {
          final price2Print = price!.multiplyByFixed(unit.amount);
          buffer.write(' @@ $price2Print');
        } else {
          buffer.write(' @ $price');
        }
      }

      return buffer.toString();
    })();