build method
Implementation
@override
Component build(BuildContext context) {
Component res;
// var add =
// additional.map((key, value) => MapEntry("$directory/$key", value));
if (cacheFiles) {
if (useLastModified) {
res = _CachedContentDeliveryWithLastModified(
_cacheFiles(directory, beforeLoad), directory,
additional: additional, before: beforeLoad, watch: useWatch);
} else {
res = _CachedContentDelivery(
_cacheFiles(directory, beforeLoad), directory,
additional: additional, before: beforeLoad, watch: useWatch);
}
} else {
if (useLastModified) {
res = _ContentDeliveryWithLastModified(directory);
} else {
res = _ContentDelivery(directory);
}
}
res = Route("{first}", root: res, handleUnknownAsRoot: true);
if (useLastModified) {
return Gate(
child: CacheControl(
child: res,
// cacheability: Cacheability.public(),
revalidation: Revalidation.mustRevalidate(IfModifiedSinceMethod()),
),
onRequest: (r) {
return r..body = Body<String>(_filePath(r));
});
}
return Gate(
child: res,
onRequest: (r) {
var f = _filePath(r);
return r..body = Body<String>(f);
});
}