setupSummaryCard function

void setupSummaryCard({
  1. required String title,
  2. String? site,
  3. String? description,
  4. String? imageUrl,
  5. String? imageAlt,
})

Set up a Twitter Summary Card based on the given arguments.

When this function is called, the HTML meta tags needed to configure the Twitter Summary Card are safely inserted into the html of the invoked web application.

Parameters

  • title: A concise title for the related content.

  • site: The Twitter @username the card should be attributed to.

  • description: A description that concisely summarizes the content as appropriate for presentation within a Tweet. You should not re-use the title as the description or use this field to describe the general services provided by the website.

  • imageUrl: A URL to a unique image representing the content of the page. You should not use a generic image such as your website logo, author photo, or other image that spans multiple pages. Images for this Card support an aspect ratio of 1:1 with minimum dimensions of 144x144 or maximum of 4096x4096 pixels. Images must be less than 5MB in size. The image will be cropped to a square on all platforms. JPG, PNG, WEBP and GIF formats are supported. Only the first frame of an animated GIF will be used. SVG is not supported.

  • imageAlt: A text description of the image conveying the essential nature of an image to users who are visually impaired. Maximum 420 characters.

reference

Implementation

void setupSummaryCard({
  required String title,
  String? site,
  String? description,
  String? imageUrl,
  String? imageAlt,
}) =>
    _appendMetaElements(
      [
        _buildRequiredMetaElement('twitter:card', 'summary'),
        _buildRequiredMetaElement('twitter:title', title),
        _buildMetaElement('twitter:site', site),
        _buildMetaElement('twitter:description', description),
        _buildMetaElement('twitter:image', imageUrl),
        _buildMetaElement('twitter:image:alt', imageAlt)
      ],
    );