convert method

List<String> convert(String data)

Converts input and returns the result of the conversion.

Source

List<String> convert(String data) {
  List<String> lines = <String>[];
  int end = data.length;
  int sliceStart = 0;
  int char = 0;
  for (int i = 0; i < end; i++) {
    int previousChar = char;
    char = data.codeUnitAt(i);
    if (char != _CR) {
      if (char != _LF) continue;
      if (previousChar == _CR) {
        sliceStart = i + 1;
        continue;
      }
    }
    lines.add(data.substring(sliceStart, i));
    sliceStart = i + 1;
  }
  if (sliceStart < end) {
    lines.add(data.substring(sliceStart, end));
  }
  return lines;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-convert/LineSplitter/convert.html