toDouble method
Checks if the string is a proper name. A proper name must:
- Not be empty.
- Start with a capital letter.
- Contain only letters, spaces, and hyphens.
Returns true if the string is a proper name, otherwise false.
Converts the string to a double or returns null if conversion fails.
Implementation
/// A proper name must:
/// - Not be empty.
/// - Start with a capital letter.
/// - Contain only letters, spaces, and hyphens.
///
/// Returns `true` if the string is a proper name, otherwise `false`.
/// Converts the string to a double or returns `null` if conversion fails.
double? toDouble() {
return double.tryParse(this);
}