Sitemap
Jecky Modi

Jecky Modi

iOS | Flutter | Freelancer

Checking dynamic variables whether has some value or null

Oct 30, 2021

In Flutter, If we don’t put enough condition to check variable is empty or null then it will throw exception and it’s so frustrating.

What are you using to check whether

  • String is empty (string != null or string != “”)
  • Array is empty (array != null || array.length != 0)
  • dictionary is empty (dict.isEmpty) or (dict.isNotEmpty)
  • bool is empty (bool != null)
  • int, float, num, double (value != null)

It’s totally headache to check all type of variables and it’s also time cosuming.

What’s the simple solution for checking any dynamic variable whether it’s empty or has some value ?

Get Jecky Modi’s stories in your inbox

Join Medium for free to get updates from this writer.

Here is the common solution for all dynamic variables.

Happy coding,
Thank you.

#flutter #flutterdevelopment
#happycoding

--

--