detectFromString method

  1. @override
CsvSettings detectFromString(
  1. String csv
)
override

Implementation

@override
CsvSettings detectFromString(String csv) {
  var needMoreData = false;

  var tryValues = (List<String>? values) {
    String? value;
    if (values != null && values.isNotEmpty) {
      value = _findFirst(csv, values);
      if (value == null) needMoreData = true;
    }
    return value;
  };

  var fieldDelimiter = tryValues(fieldDelimiters);
  var textDelimiter = tryValues(textDelimiters);
  var textEndDelimiter = tryValues(textEndDelimiters);
  var eol = tryValues(eols);

  return CsvSettings(
      fieldDelimiter, textDelimiter, textEndDelimiter, eol, needMoreData);
}