FilesystemPermission.file constructor

FilesystemPermission.file(
  1. String file
)

Create a new filesystem permission that matches a specific file.

Implementation

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