getDirFiles function

Future<String> getDirFiles(
  1. String path, {
  2. bool recursive = false,
})

Lists the files under path (optionally recursively), one per line.

Small debug helper used to inspect bundled/unpacked directories. Returns "<not found>" if the directory does not exist.

Implementation

Future<String> getDirFiles(String path, {bool recursive = false}) async {
  final dir = Directory(path);
  if (!await dir.exists()) {
    return "<not found>";
  }
  return (await dir.list(recursive: recursive).toList())
      .map((file) => file.path)
      .join('\n');
}