setDataType method
void
setDataType()
inherited
Seta o tipo das colunas onde ele estiver null
Implementation
void setDataType() {
if (list.isNotEmpty) {
selectModel?.lines.forEach((line) {
TypeData? typeData = line.typeData;
if (typeData == null) {
/// If you have at least one string, consider everything as a string
/// The other types of data require that they all have the same type
if (list.any((element) => element.object[line.key] is String)) {
typeData = TDString();
} else if (list.every((element) => element.object[line.key] is num)) {
typeData = TDNumber();
} else if (list
.every((element) => element.object[line.key] is bool)) {
typeData = TDBoolean();
} else {
typeData = TDNotString();
}
// Save the data type so you don't need to scroll through the list again
line.typeData = typeData;
}
});
}
}