Dart null / false / empty checking: How to write this shorter?

后端 未结 6 1042
逝去的感伤
逝去的感伤 2020-12-04 23:49

This is my code for true on everything but empty string, null and false:

if (routeinfo[\"no_route\"] == \"\" || routeinfo[\"no_route\"] == null || routeinfo[         


        
6条回答
  •  星月不相逢
    2020-12-05 00:07

    package:quiver has an isEmpty function that returns true if the argument is null or the empty string.

    It's also trivial to implement such a function yourself.

提交回复
热议问题