double? stringToDouble(String? value, [double? defaultValue]) { if (value == null) { return defaultValue; } return double.tryParse(value) ?? defaultValue; }