small fixes
This commit is contained in:
12
frontend/pshared/lib/utils/money.dart
Normal file
12
frontend/pshared/lib/utils/money.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:pshared/models/money.dart';
|
||||
|
||||
|
||||
double parseMoneyAmount(String? raw, {double fallback = 0}) {
|
||||
final trimmed = raw?.trim();
|
||||
if (trimmed == null || trimmed.isEmpty) return fallback;
|
||||
return double.tryParse(trimmed) ?? fallback;
|
||||
}
|
||||
|
||||
extension MoneyAmountX on Money {
|
||||
double get amountValue => parseMoneyAmount(amount);
|
||||
}
|
||||
Reference in New Issue
Block a user