any_link_preview
3.0.3, released 2 years ago by suresh-konakanchi.in
A Flutter widget that fetches and displays web link previews with customization and caching.
What it does
The package parses a URL to extract metadata using HTML, Open Graph, JSON‑LD and Twitter Card parsers. It then renders a customizable preview card and caches the metadata for faster subsequent loads.
AI-written summary of version 3.0.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- Displaying link previews in chat or messaging UIs
- Needing a highly customizable preview widget with optional image/SVG support
- Wanting built‑in caching of metadata
Skip it when
- Server‑side rendering or non‑Flutter environments
- Complex backend data aggregation beyond simple link metadata
- When you need fine‑grained network control beyond the provided fetch logic
Strengths
- Extensive customization of appearance and behavior
- Supports SVG images and custom User‑Agent strings
- Built‑in caching with configurable TTL
- Robust error handling and placeholder widgets
Weaknesses
- Limited to Flutter apps; not a pure networking library
- Caching relies on shared_preferences which may not suit all storage needs
- May require tweaking User‑Agent or proxy for some sites
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 7
Add the dependency, import the package, ensure internet permission on Android/iOS (default), optionally configure shared_preferences for caching
AnyLinkPreview(
link: "https://example.com",
displayDirection: UIDirection.uiDirectionHorizontal,
showMultimedia: true,
);Alternatives
Packages that do the same job and could replace any_link_preview.
- flutter_link_previewer
Customizable Flutter widget to fetch and render URL link previews.
91Compare - tutorial_coach_mark
Presents your app and its features using customizable guides and focused highlights.
84Compare - uiblock
Easily block or unblock the UI with loading states in Flutter apps.
48Compare - flutter_earth_globe
An interactive and fully customizable 3D Globe widget written in pure Dart.
80Compare
Works with
Packages commonly used together with any_link_preview: ones it builds on, ones built on it, and its own family.
- xmlany_link_preview depends on itFull-featured XML and XPath library for DOM parsing, SAX streaming, and fluent building.
- htmlany_link_preview depends on itA Dart implementation of an HTML5 parser for strings and bytes.
- url_launcherany_link_preview depends on itFlutter plugin for launching URLs across mobile, desktop, and web platforms.
- shared_preferencesany_link_preview depends on itFlutter plugin for reading and writing simple key-value pairs. Wraps NSUserDefaults on iOS and SharedPreferences on Android.
- flutter_svgany_link_preview depends on itRenders Scalable Vector Graphics (SVG 1.1) and precompiled vector graphics in Flutter.
- string_validatorany_link_preview depends on itString validation and sanitization library for Dart.
- chatviewBuilt on any_link_previewA customizable Flutter chat UI package with list and conversation views.