getx icon indicating copy to clipboard operation
getx copied to clipboard

'isBlank' method doesn't check for null

Open Apollo108 opened this issue 4 years ago • 5 comments

Tried to use 'isNullOrBlank', but it says it's deprecated in favour of 'isBlank'. But according to the code seems the latter does not do it's job, correct me, if I'm wrong.

Screenshots image image

Flutter Version: Stable channel, 1.22.5

Getx Version: 3.24.0

Apollo108 avatar Jan 06 '21 12:01 Apollo108

This had to be done, because GetX is being prepared to be NullSafety

eduardoflorence avatar Jan 06 '21 15:01 eduardoflorence

We need to deprecate this for the null-safety update, but I already found a loophole to make this possible again. I need to make sure that this will not be changed in the future, so I am waiting a while to make this possible again with GetX. However, I already notice that to check for null, you will need parentheses, example:

String? name;

void check() {
final isNull = (name).isNullOrBlank;
print(isNull); // out: true
}

final isNull = name.isNullOrBlank; WILL FAIL.

jonataslaw avatar Jan 07 '21 03:01 jonataslaw

Any update?

BaoDevFS avatar May 18 '21 03:05 BaoDevFS

@jonataslaw please bring this back, and pls update if you need help in upgrading this

samsheldin avatar Jun 28 '21 11:06 samsheldin

final isNull = name.isNullOrBlank;

Would be

final isNull = name?.isNullOrBlank;

kondwa avatar Mar 23 '24 17:03 kondwa