bool shouldIncludeItem(FileSystemEntity entity)

Source

bool shouldIncludeItem(FileSystemEntity entity) {
  var ignoreFiles = [
    "packages",
    "pubspec.lock",
    "Dart_Packages.xml",
    "workspace.xml",
    "tasks.xml",
    "vcs.xml",
  ];

  var hiddenFilesToKeep = [".gitignore", ".travis.yml", ".analysis_options"];

  var lastComponent = entity.uri.pathSegments.last;
  if (lastComponent.length == 0) {
    lastComponent =
        entity.uri.pathSegments[entity.uri.pathSegments.length - 2];
  }

  if (lastComponent.startsWith(".") &&
      !hiddenFilesToKeep.contains(lastComponent)) {
    return false;
  }

  if (ignoreFiles.contains(lastComponent)) {
    return false;
  }

  return true;
}