getListBool static method
Implementation
static List<bool> getListBool(Map? data, String key) {
List<bool> lst = [];
if (data == null) return lst;
try {
var arrKeys = key.split('.');
if (arrKeys.length == 2) {
if (data.containsKey(arrKeys[0])) {
List<dynamic> lstObj = data[arrKeys[0]] as List<dynamic>;
if (lstObj.isNotEmpty) {
for (int index = 0; index < lstObj.length; index++) {
Map map = lstObj[index];
lst.add(getBool(map, arrKeys[1], defaultValue: false));
}
}
return lst;
}
} else {
List<dynamic> lstObj = data[key] as List<dynamic>;
if (lstObj.isNotEmpty) {
for (int index = 0; index < lstObj.length; index++) {
lst.add(toBool(lstObj[index].toString()));
}
}
}
return lst;
} catch (e) {
return lst;
}
}