getMaxLinesContent function Null safety

int getMaxLinesContent(
  1. String? text
)

This method returns the maximum lines in the given text content

Implementation

int getMaxLinesContent(String? text) {
  return text != null && text.isNotEmpty && text.contains('\n')
      ? text.split('\n').length
      : 1;
}