fixnum icon indicating copy to clipboard operation
fixnum copied to clipboard

Add `tryParse` methods

Open lrhn opened this issue 3 years ago • 0 comments

The class Int64 has a parse method, but no tryParse method.

I suggest adding a try version of each of the parse methods (parse, parseHex, parseRadix), which returns null instead of throwing a FormatException in case of invalid inputs.

In null-safe Dart (even more than before) it's often more useful to get a null value than a thrown FormatException.

(Also, the parse methods must document which exceptions they throw. That's as important as what type they return. #35)

lrhn avatar Nov 22 '22 13:11 lrhn