pretty_diff_text
2.1.0, released 2 years ago by an unverified publisher
Widget that displays differences between two texts using RichText
What it does
PrettyDiffText compares two strings and renders the added, deleted, and unchanged parts with distinct styles. It uses diff-match-patch under the hood and exposes many customization options.
AI-written summary of version 2.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a visual diff of two text snippets in a Flutter UI
- You want to highlight changes in a document or code review
- You want a lightweight, pure‑Dart solution that works on all platforms
Skip it when
- You need to diff very large texts or streams of data
- You require real‑time diff updates with high performance
- You are building a non‑textual diff (e.g., JSON or binary)
Strengths
- Pure Dart, no native dependencies
- Cross‑platform support (Android, iOS, web, desktop)
- Highly customizable styles and cleanup options
Weaknesses
- No built‑in performance tuning for large inputs
- Limited to text diffs only
- No support for diffing structured data
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add dependency to pubspec and import package
import 'package:pretty_diff_text/pretty_diff_text.dart';
PrettyDiffText(
oldText: "Hello world",
newText: "Hello Flutter world",
);Alternatives
Packages that do the same job and could replace pretty_diff_text.
- re_editor
A lightweight text and code editor widget for Flutter with syntax highlighting and folding.
80Compare - single_child_two_dimensional_scroll_view
A widget that allows a single child to scroll in two dimensions.
57Compare - native_dialog_plus
Shows native alert and confirm dialogs on iOS, Android, Web, and macOS.
63Compare - flutter_gcaptcha_v3
Provides a Flutter widget to integrate Google reCAPTCHA v3 on iOS and Android.
38Compare
Works with
Packages commonly used together with pretty_diff_text: ones it builds on, ones built on it, and its own family.