VirtualDirectory constructor

  1. String root, {
  2. String? pathPrefix,

Create a new VirtualDirectory for serving static file content of the path root.

The root is not required to exist. If the root doesn't exist at time of a request, a 404 response is generated.

If pathPrefix is set, pathPrefix will indicate the expected path prefix of incoming requests. When locating the resource on disk, the prefix will be trimmed from the requests uri, before locating the actual resource. If the requests uri doesn't start with pathPrefix, a 404 response is generated.


VirtualDirectory(this.root, {String? pathPrefix}) : _pathPrefixSegments = _parsePathPrefix(pathPrefix);