google / flutter-provide

A simple framework for state management in Flutter.
https://pub.dartlang.org/packages/provide
BSD 3-Clause "New" or "Revised" License
810 stars 58 forks source link

About operator priority problem #19

Open ModWU opened 4 years ago

ModWU commented 4 years ago

Explain: '||' > '??' Actually, so 'parent?.updateShouldNotify(oldWidget.parent) ?? false || providers != oldWidget.providers' equals 'parent?.updateShouldNotify(oldWidget.parent) ?? providers != oldWidget.providers'

Suggestion: change "@override bool updateShouldNotify(_InheritedProviders oldWidget) { return parent?.updateShouldNotify(oldWidget.parent) ?? false || providers != oldWidget.providers; }" to "@override bool updateShouldNotify(_InheritedProviders oldWidget) { return providers != oldWidget.providers ? true : (parent ?.updateShouldNotify(oldWidget.parent) ?? false); }