Link Preview Generator

Pub build CodeFactor License Donate

A cross-platform flutter package to convert your links into rich beautiful previews.
This package is inspired from Any Link Preview package, but the entire parsing & scrapping logic has been re-written to be more robust & to support more links. It also provides control over complete customization of the widget.


Widget Example

import 'package:link_preview_generator/link_preview_generator.dart';

/// Generate a beautiful link preview card widget
    bodyMaxLines: 3,
    link: '',
    linkPreviewStyle: LinkPreviewStyle.large,
    showGraphic: true,

Function Example

import 'package:link_preview_generator/link_preview_generator.dart';

/// Pass the URL to be parsed/scraped
/// to build your own custom widget with parsed data
final WebInfo info = await LinkPreview.scrapeFromURL('');

/// Description of the page.
final String description = info.description;

/// Domain name of the link.
final String domain = info.domain;

/// Favicon of the page.
final String icon = info.icon;

/// Image URL, if present any in the link.
final String image = info.image;

/// Title of the page.
final String title = info.title;

/// Link preview type of the rule used for scrapping the link.
/// Returns [LinkPreviewType.error] if the scrapping is failed.
final LinkPreviewType type = info.type;

/// Video URL, if present any in the link.
final String video =;

Props & Methods


linkURL to display as previewStringtrue
backgroundColorCustomize the background colour of widgetColordefault(Color.fromRGBO(248, 248, 248, 1.0))false
bodyMaxLinesMaximum number of description body linesintdefault(auto)false
bodyStyleCustomize the description body styleTextStyleN.Afalse
bodyTextOverflowOverflow type for description body textTextOverflowdefault(TextOverflow.ellipsis)false
borderRadiusBorder radius for the widget carddoubledefault(12.0)false
boxShadowBox shadow for the widget cardList<BoxShadow>false
cacheDurationCache the parsed result for a certain durationDurationdefault(Duration(days: 7))false
errorBodyBody that need to be shown if parsing failsStringdefault(Oops! Unable to parse the url.)false
errorImageImage URL that will be shown if parsing failsStringdefault(A crying semi-soccer ball image)false
errorTitleTitle that need to be shown if parsing failsStringdefault(Something went wrong!)false
errorWidgetWidget shown if parsing fails. Defaults to plain containerWidgetfalse
graphicFitAdjust the box fit of the imageBoxFitdefault(BoxFit.cover)false
linkPreviewStyleLink Preview card display styleLinkPreviewStyledefault(large) small,largefalse
onTapFunction that needs to be called when user taps on the cardFunction()default(launchURL(link))false
placeholderWidgetWidget shown when parsing the linkWidgetfalse
proxyUrlProxy URL to pass that resolve CORS issues on webStringexample(
removeElevationTo remove the widget card elevationbooldefault(false) true,falsefalse
showBodyShow or Hide body text (Description)booldefault(true) true,falsefalse
showDomainShow or Hide domain namebooldefault(true) true,falsefalse
showGraphicShow or Hide the image after parsing, if availablebooldefault(true) true,falsefalse
showTitleShow or Hide titlebooldefault(true) true,falsefalse
titleStyleCustomize the title styleTextStyleN.Afalse


  1. Fork it

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Added some feature')

  4. Push to the branch (git push origin my-new-feature)

  5. Create new Pull Request


Image of contributors