watchRecursive method

void watchRecursive({
  1. required void onData(
    1. FileSystemEvent fileSystemEvent
    ),
  2. bool recursive = false,
  3. bool followLinks = true,
})

watch recursive

Implementation

void watchRecursive({
  required void Function(FileSystemEvent fileSystemEvent) onData,
  bool recursive = false,
  bool followLinks = true,
}) {
  local_sort();

  for (var i = 0; i < length; i++) {
    FileSystemEntity fileSystemEntity = this[i];
    if (fileSystemEntity is Directory) {
      String base_name = path.basename(fileSystemEntity.uri.toFilePath());
      if (RegExp(r"^([.])", caseSensitive: false).hasMatch(base_name)) {
        if ([".github", ".idea"].contains(base_name) == false) {
          continue;
        }
      }
      fileSystemEntity.watch().listen(onData);
      fileSystemEntity.listSync().watchRecursive(onData: onData);
    } else {}
  }
  return;
}