removeEmptyLine method
Removes empty lines from a multi-line string.
This extension method removes any lines from the string that contain only whitespace characters (spaces, tabs, etc.), or no characters at all. It preserves leading and trailing whitespace on lines that are not empty.
For example, the string " \n\nHello\n\n\nworld!\n\n " would be cleaned up to " \nHello\nworld!\n ".
Returns the string with empty lines removed.
Implementation
String removeEmptyLine() => this.replaceAll(RegExp(r'\n\s*\n'), '\n');