fileTypeHandler top-level property
TypeHandler
fileTypeHandler
Implementation
TypeHandler get fileTypeHandler =>
TypeHandler<File>((HttpRequest req, HttpResponse res, File file) async {
if (file.existsSync()) {
res.setContentTypeFromFile(file);
await res.addStream(file.openRead());
return res.close();
} else {
throw NotFoundError();
}
});