ResponseWithCacheControl<T> constructor
ResponseWithCacheControl<T> (
- dynamic body, {
- required Request request,
- required T data,
Implementation
factory ResponseWithCacheControl(dynamic body,
{required Request request, required T data}) {
if (T == String) {
return ResponseWithEtag(body, request: request, etag: data as String)
as ResponseWithCacheControl<T>;
}
if (T == DateTime) {
return ResponseWithLastModified(body,
request: request,
lastModified: data as DateTime) as ResponseWithCacheControl<T>;
}
throw UnimplementedError("Only String or DateTime implemented");
}