What changed, and why it matters
This commit simply deletes two unused helper functions that converted numbers between different locale formats (for example, swapping commas and periods used as decimal separators). Because the functions were not being used anywhere in the app, removing them does not change app behavior and does not fix or introduce a security issue.
No security action needed. Treat as routine dead-code cleanup. If maintaining the codebase, verify via static analysis or search that the removed functions have no remaining references.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff removes normalizeLocalizedNumber and tryParseLocalizedNumber static methods from lib/utilities/amount/amount.dart. The commit message states they are unused. No call sites are removed, no logic is changed, and no security-sensitive behavior is modified. The remaining tryParseEditableDecimal method is left untouched.
Changed components
lib/utilities/amount/amount.dartInspect captured patch +0 / −61
diff --git a/lib/utilities/amount/amount.dart b/lib/utilities/amount/amount.dart
index c123fc1..bc337be 100644
--- a/lib/utilities/amount/amount.dart
+++ b/lib/utilities/amount/amount.dart
@@ -32,67 +32,6 @@ class Amount {
fractionDigits: fractionDigits,
);
- static String normalizeLocalizedNumber(
- String value, {
- required String locale,
- }) {
- final symbols = Util.getSymbolsFor(locale: locale);
- final groupSeparator = symbols?.GROUP_SEP ?? ",";
- final decimalSeparator = symbols?.DECIMAL_SEP ?? ".";
-
- if (groupSeparator == "." &&
- decimalSeparator != "." &&
- !value.contains(decimalSeparator)) {
- return RegExp(r'^[1-9]\d{0,2}(\.\d{3})+$').hasMatch(value)
- ? value.replaceAll(groupSeparator, "")
- : value;
- }
-
- return value
- .replaceAll(groupSeparator, "")
- .replaceFirst(decimalSeparator, ".");
- }
-
- static Decimal? tryParseLocalizedNumber(
- String value, {
- required String locale,
- }) {
- if (value.isEmpty || value.contains(RegExp(r'[+\-\x09-\x0D ]'))) {
- return null;
- }
-
- final symbols = Util.getSymbolsFor(locale: locale);
- final groupSeparator = symbols?.GROUP_SEP ?? ",";
- final decimalSeparator = symbols?.DECIMAL_SEP ?? ".";
- final escapedGroup = RegExp.escape(groupSeparator);
- final escapedDecimal = RegExp.escape(decimalSeparator);
- final integerPattern =
- r'(?:\d+|[1-9]\d{0,2}(?:' + escapedGroup + r'\d{3})+)';
- final localizedPattern = RegExp(
- '^(?:$integerPattern(?:$escapedDecimal\\d+)?|$escapedDecimal\\d+)\$',
- );
-
- if (groupSeparator == "." &&
- decimalSeparator != "." &&
- !value.contains(decimalSeparator) &&
- RegExp(r'^[1-9]\d{0,2}\.\d{3}$').hasMatch(value)) {
- return null;
- }
-
- if (localizedPattern.hasMatch(value)) {
- return Decimal.tryParse(normalizeLocalizedNumber(value, locale: locale));
- }
-
- if (groupSeparator == "." &&
- decimalSeparator != "." &&
- !value.contains(decimalSeparator) &&
- RegExp(r'^(?:\d+(?:\.\d+)?|\.\d+)$').hasMatch(value)) {
- return Decimal.tryParse(value);
- }
-
- return null;
- }
-
static Decimal? tryParseEditableDecimal(
String value, {
required String locale,
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.