You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
308 B

2 years ago
  1. const EMPTY = "";
  2. const ZERO = 0;
  3. extension NonNullString on String{
  4. String orEmpty(){
  5. if(this == null){
  6. return EMPTY;
  7. } else {
  8. return this;
  9. }
  10. }
  11. }
  12. extension NonNullInt on int{
  13. int orEmpty(){
  14. if(this == null){
  15. return ZERO;
  16. } else {
  17. return this;
  18. }
  19. }
  20. }