filesOf static method

Future<Map<String, List<int>>> filesOf(
  1. String dir
)

The files of a working folder (dir/layers, dir/sounds) as archive entries.

Implementation

static Future<Map<String, List<int>>> filesOf(String dir) async {
  final out = <String, List<int>>{};
  for (final sub in const ['layers', 'sounds']) {
    final d = Directory(p.join(dir, sub));
    if (!await d.exists()) continue;
    await for (final e in d.list(recursive: true)) {
      if (e is File) {
        out[p.relative(e.path, from: dir).replaceAll('\\', '/')] = await e
            .readAsBytes();
      }
    }
  }
  return out;
}