writeData method
Writes the current record to the CSV file, if is not empty. The current record is considered empty if all
of its values are null
or their String representations are empty or contain only whitespaces. If data
is provided, it is passed to setData to populate the internal data record before the write operation occurs.
After the record has been written to the underlying StringSink, the count of records is incremented and the
internal data record is reset unless clear
is false
.
Implementation
void writeData({dynamic data, bool clear = true}) {
if (data != null) {
setData(data);
}
if (!_data.isEmpty) {
_wrapper.write('${_data.toCsv()}$endOfLine');
_rowCount++;
if (clear) {
clearData();
}
}
}