FilesystemPermission.directory constructor

FilesystemPermission.directory(
  1. String dir
)

Create a new filesystem permission that matches any file in a directory or one of its subdirectories.

Implementation

factory FilesystemPermission.directory(String dir) {
  final escaped = dir.replaceAll(r'\', r'\\').replaceAll(r'/', r'\/');
  return FilesystemPermission(RegExp('^$escaped.*'));
}