packagesHandler function

Handler packagesHandler({
  1. Map<String, Uri>? packageMap,
})

A handler that serves the contents of a virtual packages directory.

This effectively serves package:${request.url}. It locates packages using the mapping defined by packageMap. If packageMap isn't passed, it defaults to the current isolate's package resolution logic.

The packageMap maps package names to the base uri for resolving package: uris for that package.

This can only serve assets from file: URIs.

Implementation

Handler packagesHandler({Map<String, Uri>? packageMap}) =>
    PackageConfigHandler(packageMap: packageMap).handleRequest;