formatValue method
Format a single value or string as a delimiter-separated value, returning a string.
A value that contains either the delimiter, a double-quote ("
) or a
newline will be escaped using double-quotes.
Implementation
String formatValue(Object? value) {
String formatted;
return value == null
? ""
: value is DateTime
? _formatDate(value)
: _reFormat.hasMatch(formatted = value.toString())
? '"${formatted.replaceAll('"', '""')}"'
: value.toString();
}