Skip to content
pubscout

simple_link_preview

2.1.0, released 2 months ago by an unverified publisher

Fetch lightweight link preview metadata from HTTP and HTTPS URLs.

WASM-readyCopyleft license
$ flutter pub add simple_link_preview
Source repository

What it does

SimpleLinkPreview fetches and parses HTML metadata from the document head, direct images, and other web content types without downloading entire bodies. It handles redirects, custom timeouts, status validation, and relative URL resolution.

AI-written summary of version 2.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to display link previews or Open Graph cards in your app.
  • You want to extract titles, descriptions, icons, and images from web pages efficiently.

Skip it when

  • You need to scrape full HTML documents and inspect body elements.
  • You need a full embedded web browser view.

Strengths

  • Lightweight and stops reading HTML as soon as the closing head tag or 1MB limit is reached.
  • Supports direct images and various successful MIME types.
  • Provides structured error handling and options like timeout and redirect limits.

Weaknesses

  • Subject to target server's CORS policy on web platforms.
  • Does not inspect <img> elements in the document body or make separate favicon requests.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2

not documented

Future<void> main() async {
  final preview = await SimpleLinkPreview.getPreview(
    'https://pub.dev/',
  );
  print(preview?.toJson());
}

Alternatives

Packages that do the same job and could replace simple_link_preview.

Works with

Packages commonly used together with simple_link_preview: ones it builds on, ones built on it, and its own family.