dart - Removing empty lines while reading a file in Dartlang -


i have file like:

a b   c d 

both readaslines() , readasstring() + string.split('\n') give me:

[a, b, , , c, d] 

what smartest way get?

[a,b,c,d] 

one possibility be:

import 'dart:io';  main() {   file f = new file('test.txt');   f.readaslines().then((list<string> lines) {     print(lines.where((string s) => s.isnotempty));   }); } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -