Skip to content
pubscout

pretty_diff_text

2.1.0, released 2 years ago by an unverified publisher

Widget that displays differences between two texts using RichText

WASM-ready
$ flutter pub add pretty_diff_text
Source repository

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.

Works with

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