SeoHead class

Declarative SEO meta tags management widget.

Place this in your widget tree (typically at the page level) to set all meta tags for the current page. When this widget is removed or updated, meta tags update automatically.

Basic usage:

SeoHead(
  title: 'My Page Title',
  description: 'Page description for search engines',
  child: MyPageContent(),
)

Full usage:

SeoHead(
  title: 'Product Name',
  description: 'Amazing product that solves your problems',
  canonicalUrl: 'https://example.com/products/my-product',
  keywords: ['flutter', 'seo', 'web'],
  ogTags: OgTags(
    image: 'https://example.com/og-image.png',
    type: OgType.product,
  ),
  twitterCard: TwitterCardConfig(
    card: TwitterCardType.summaryLargeImage,
    creator: '@myhandle',
  ),
  structuredData: [
    ProductSchema(name: 'Product Name', ...),
  ],
  child: ProductPageContent(),
)
Inheritance

Constructors

SeoHead({Key? key, String? title, String? description, List<String>? keywords, String? canonicalUrl, String? author, OgTags? ogTags, String? ogImage, OgType? ogType, TwitterCardConfig? twitterCard, bool? indexable, bool? followable, String? robots, List<JsonLdSchema>? structuredData, String? noscriptTitle, String? noscriptDescription, String? noscriptBody, List<NoscriptLink>? noscriptLinks, Map<String, String>? customMeta, Map<String, String>? customPropertyMeta, List<Map<String, String>>? customLinkTags, bool trackPageView = true, Map<String, dynamic>? trackingParameters, Widget? child})
const

Properties

author String?
Author name
final
canonicalUrl String?
Canonical URL for this page
final
child Widget?
Child widget — SeoHead can wrap content or be standalone
final
customLinkTags List<Map<String, String>>?
Custom link tags
final
customMeta Map<String, String>?
Custom name-based meta tags
final
customPropertyMeta Map<String, String>?
Custom property-based meta tags
final
description String?
Meta description — used for description and og:description fallback
final
followable bool?
Whether search engines should follow links on this page
final
hashCode int
The hash code for this object.
no setterinherited
indexable bool?
Whether search engines should index this page
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keywords List<String>?
Meta keywords
final
noscriptBody String?
Custom HTML body for noscript fallback
final
noscriptDescription String?
Description for noscript fallback (defaults to description)
final
Navigation links for noscript fallback
final
noscriptTitle String?
Title for noscript fallback (defaults to title)
final
ogImage String?
Shorthand for og:image (used when ogTags is null)
final
ogTags OgTags?
Open Graph tags — if null, falls back to title/description/image
final
ogType OgType?
Shorthand for og:type (used when ogTags is null)
final
robots String?
Raw robots directive (overrides indexable/followable)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
structuredData List<JsonLdSchema>?
JSON-LD structured data schemas to inject
final
title String?
Page title — used for title and og:title fallback
final
trackingParameters Map<String, dynamic>?
Additional analytics parameters for page view tracking
final
trackPageView bool
Whether to automatically track a page view
final
twitterCard TwitterCardConfig?
Twitter card configuration
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<SeoHead>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited