simc / dartx

Superpowers for Dart. Collection of useful static extension methods.
https://pub.dev/packages/dartx
Apache License 2.0
1.09k stars 87 forks source link

Fix "was called on null" error #109

Closed priezz closed 3 years ago

priezz commented 4 years ago

Returns null when any min/max method is called on no elements, prevents "The getter 'getterName' was called on null" error and similar.

codecov[bot] commented 4 years ago

Codecov Report

Merging #109 into master will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #109      +/-   ##
==========================================
+ Coverage   96.28%   96.30%   +0.01%     
==========================================
  Files          10       10              
  Lines         781      784       +3     
==========================================
+ Hits          752      755       +3     
  Misses         29       29              
Impacted Files Coverage Δ
lib/src/iterable.dart 99.41% <100.00%> (+<0.01%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b488b17...5fa748c. Read the comment docs.

simc commented 3 years ago

That's great! Could you maybe also add a test which confirms the behaviour?

priezz commented 3 years ago

That's great! Could you maybe also add a test which confirms the behaviour?

Sorry working hard on our app (cashcoach.io), so I would appreciate if you merge it as is. We use a fork with this very fix for now, so it would be great to switch back to the upstream.

passsy commented 3 years ago

Thanks for you contribution. I ran into this myself. This has been automatically fixed when we migrated to nullsafety.