From 4ad8dd063ac114a013734b9cb9098bf6f4482311 Mon Sep 17 00:00:00 2001 From: abhinavdroid Date: Tue, 12 May 2026 14:03:09 +0530 Subject: [PATCH] hot-fix(currency): adjust small decimal formatting logic https://app.asana.com/1/34125054317482/project/1200301693863971/task/1214652452633418?focus=true Signed-off-by: Abhinav Gupta --- lib/src/utils/currency/helper.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/src/utils/currency/helper.dart b/lib/src/utils/currency/helper.dart index bf8511a..9fc7092 100644 --- a/lib/src/utils/currency/helper.dart +++ b/lib/src/utils/currency/helper.dart @@ -47,11 +47,14 @@ class CurrencyUtil { roundNumber(inputValue, fractionDigits: requiredDecimalDigits); final compactResult = _getCompactFormatResult(normalizedValue); final compactValue = compactResult.value; - final int usedDecimalDigits = (showExplicitDecimals || - (useCompact && compactValue % 1 != 0) || - inputValue % 1 != 0) + final int usedDecimalDigits = showExplicitDecimals ? requiredDecimalDigits - : 0; + : roundNumber(normalizedValue) == roundNumber(normalizedValue).toInt() + ? 0 + : roundNumber(normalizedValue * 10) == + roundNumber(normalizedValue * 10).toInt() + ? 1 + : requiredDecimalDigits; final localFormatter = locale.getCurrencyFormatNoSymbol(usedDecimalDigits); try {