Map? toSendMap = {
1: "",
2: "",
3: "",
4: "",
5: "",
6: "",
7: "",
8: "",
9: "",
10: "",
11: "",
12: "",
13: "",
14: "",
15: "",
16: "",
17: "",
18: "",
19: "",
20: "",
21: "",
22: "",
23: "",
24: "",
25: "",
26: "",
27: "",
28: "",
29: "",
30: "",
31: "",
};
Here is my Map data and I want to control it if it has any key is empty . What should I write to check it?
I tried every way but I couldn’t get any result.
2
Answers
You can get values like
youMap.values
, then you can make it list and joint into single string to perform empty string check.If every value in map is not empty then this will return true
var isValid = toSendMap?.values.every((element) => (element as String).isNotEmpty)