description

# convert method Null safety

List<String> convert (

1. String data

)

## Implementation

    List<String> convert(String data) {
      var lines = <String>[];
      var end = data.length;
      var sliceStart = 0;
      var char = 0;
      for (var i = 0; i < end; i++) {
        var 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;
    }