FilesystemReadPermission.file constructor

FilesystemReadPermission.file(
  1. String file
)

Create a new filesystem permission that matches a specific file.

Implementation

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