Committed by
GitHub
Merge pull request #591 from MrOlolo/fix/null-or-blank_function
fix isNullOrBlank function
Showing
1 changed file
with
2 additions
and
7 deletions
| @@ -14,14 +14,9 @@ class GetUtils { | @@ -14,14 +14,9 @@ class GetUtils { | ||
| 14 | static bool isNullOrBlank(dynamic s) { | 14 | static bool isNullOrBlank(dynamic s) { | 
| 15 | if (isNull(s)) return true; | 15 | if (isNull(s)) return true; | 
| 16 | 16 | ||
| 17 | - switch (s.runtimeType as Type) { | ||
| 18 | - case String: | ||
| 19 | - case List: | ||
| 20 | - case Map: | ||
| 21 | - case Set: | ||
| 22 | - case Iterable: | 17 | + if (s is String || s is List || s is Map || s is Set || s is Iterable) { | 
| 23 | return s.isEmpty as bool; | 18 | return s.isEmpty as bool; | 
| 24 | - default: | 19 | + } else { | 
| 25 | return s.toString() == 'null' || s.toString().trim().isEmpty; | 20 | return s.toString() == 'null' || s.toString().trim().isEmpty; | 
| 26 | } | 21 | } | 
| 27 | } | 22 | } | 
- 
Please register or login to post a comment