formatWithSign method

String formatWithSign([
  1. int numberOfDecimals = 2,
  2. bool ignoreDecimalIfZero = true
])

Implementation

String formatWithSign(
    [int numberOfDecimals = 2, bool ignoreDecimalIfZero = true]) {
  final price = formatWithoutSign(numberOfDecimals, ignoreDecimalIfZero);
  final sign = value < 0
      ? '-'
      : (value > 0)
          ? '+'
          : '';

  return '$sign$price';
}