toDecimal property
Decimal?
toDecimal
Converts the string to a Decimal. Returns null if the conversion fails.
Requires the decimal
package.
Example:
print('123.45'.toDecimal); // Output: Decimal(123.45) assuming decimal is implemented
print('abc'.toDecimal); // Output: null
Implementation
Decimal? get toDecimal => Decimal.tryParse(this);