I have a dropdown that is populated with api values. The option values are Int type and the label values String type, as I show below.
Unfortunately, when the api returns a null value, the widget breaks. I have tried to create two custom functions to validate if the JSON type (from the api) is null and if so, return [], but couldn't solve the problem.
Now, I have two questions:
1) How to handle null values on a dropdown with int a string values?
2) Is there any smart way to handle null safety using one function to all data types or I have to create nullcheck for each data type I use?
PS: I created two functions, one to return int type and another to string type.