When creating a formatter with a null decimalDigits and using the formatString method, a TypeError is thrown because a non-null assertion operator is used when checking if decimalDigits is positive.
num _parseStrToNum(String text) {
num value = num.tryParse(text) ?? 0;
// THIS LINE
if (format.decimalDigits! > 0) {
value /= pow(10, format.decimalDigits!);
}
return value;
}
When creating a formatter with a null
decimalDigits
and using theformatString
method, aTypeError
is thrown because a non-null assertion operator is used when checking ifdecimalDigits
is positive.