fromRoute static method
Creates a DocumentBuilder that fetches a route by path or ID.
Implementation
static DocumentBuilder<RouteBase> fromRoute({
Key? key,
Uri? url,
String? routeId,
required Widget Function(BuildContext, RouteBase) buildContent,
bool includeDrafts = false,
bool allowRefresh = true,
bool isLive = false,
}) {
assert(
(url != null && routeId == null) || (url == null && routeId != null),
'Either url or routeId must be provided, but not both.',
);
return DocumentBuilder<RouteBase>(
key: key,
fetchDocument: () => vyuh.content.provider.fetchRoute(
path: url?.path,
routeId: routeId,
),
liveDocument: isLive
? vyuh.content.provider.live.fetchRoute(
path: url?.path,
routeId: routeId,
includeDrafts: includeDrafts,
)
: null,
initDocument: (context, document) async {
return await document.init(context);
},
buildContent: buildContent,
allowRefresh: allowRefresh,
isLive: isLive,
);
}