nonEmptyLineCount function

int nonEmptyLineCount(
  1. String str
)

Determines the number of lines that are non-empty.

Implementation

int nonEmptyLineCount(String str) {
  var _nonEmptyLineCount = 0;
  str.where((e) => !e.isWhiteSpace).length;
  for (var i = 1; i < str.length; i++) {
    if (str[i] == '\n' && str[i - 1] != '\n') {
      _nonEmptyLineCount++;
    }
  }
  return _nonEmptyLineCount;
}