VyuhContentWidget<T extends ContentItem>.fromDocument constructor
VyuhContentWidget<T extends ContentItem>.fromDocument ({})
Creates a VyuhContentWidget that loads a single Document from the CMS.
If a query is not provided, it will default to a Sanity GROQ query.
This assumes that you have setup a SanityContentProvider for the ContentPlugin.
Implementation
factory VyuhContentWidget.fromDocument({
Key? key,
required String identifier,
String? query,
Map<String, String>? queryParams,
Widget Function(BuildContext, Document)? builder,
}) =>
VyuhContentWidget<Document>(
key: key,
query: query ?? _defaultSanityQuery,
queryParams: queryParams ??
{
'identifier': identifier,
},
fromJson: Document.fromJson,
builder: builder ?? _defaultDocumentBuilder,
) as VyuhContentWidget<T>;