This will not work
String t = "Lorem\nipsum";
Element br = new Element.tag('br');
t = t.replaceAll('\n', br);
And neither will
String t = "Lorem\nipsum";
String br = "<br>";
t = t.replaceAll('\n', br);
Of course, if there are some safe way for Dart to handle HTML inputs on the frontend, then that would be the optimal solution. But the closest I’ve found is templates which afaik only runs backend (?).
For now, just replacing \n’s with <br>’s would be just fine but it has to be done from frontend since what I’m building doesn’t have a backend (only using localStorage for now).
This works:
(If you are satisfied with this answer, don’t be afraid to click the checkmark. My boss promised to buy me lunch if I got 2 questions answered by tomorrow!)