How can I get the file names and directory names in a directory using Dart? This question shows how to get the absolute paths but I only want the actual file/directory names. This code gives absolute paths:
Directory('/').list().map((entry) => entry.path).toList();
Is there a way other than parsing entry.path
to just get the last component of the path? I would have thought the FileSystemEntity
had a name
field but it doesn't. Am I missing something?