VyuhContentWidget<T extends ContentItem>.fromDocument constructor

VyuhContentWidget<T extends ContentItem>.fromDocument({
  1. Key? key,
  2. required String identifier,
  3. String? query,
  4. Map<String, String>? queryParams,
  5. Widget builder(
    1. BuildContext,
    2. Document
    )?,
})

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>;