Search packages, repositories and app categories

Package detailsv0.4.1

diff_match_patch

The Diff Match and Patch libraries offer robust algorithms to perform the operations required for synchronizing plain text.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
1.8M
Likes
41
Pub points
130

Install package

flutter pub add diff_match_patch

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The diff_match_patch package provides efficient algorithms for computing differences (diffs), finding matches, and generating patches between text strings. It is ideal for synchronizing plain text across different versions, such as in collaborative editing or version control systems. The library supports accurate, human-readable diffs and can apply patches to restore original text. Designed for performance and reliability, it works seamlessly across multiple platforms including mobile, web, and desktop. It's particularly useful when real-time text synchronization or conflict resolution is needed.

Use cases

  • Real-time collaborative text editing
  • Version control text diffing
  • Text synchronization across devices
  • Automated patch application
  • Conflict resolution in text-based systems
  • Code or document comparison tools

Key features

  • Accurate and efficient diff computation
  • Robust patch generation and application
  • Support for bidirectional text synchronization
  • Cross-platform compatibility
  • Human-readable output format
  • Minimal memory overhead

Suitable for

  • Collaborative applications
  • Text editors with history tracking
  • Versioned document systems
  • Offline-first apps with sync capabilities
  • Tools requiring precise text change detection

Considerations

  • Not optimized for binary data
  • Large text comparisons may impact performance
  • Requires careful handling of edge cases in patch application
  • Limited built-in UI components
  • Best suited for plain text, not structured formats

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Diff Match Patch

This is a port of google-diff-match-patch library to Dart. Initially maintained by localvoid, handed off to jheyne for upgrades.

Algorithms

This library implements Myer's diff algorithm which is generally considered to be the best general-purpose diff. A layer of pre-diff speedups and post-diff cleanups surround the diff algorithm, improving both performance and output quality.

This library also implements a Bitap matching algorithm at the heart of a flexible matching and patching strategy.

Categories

Source repository

Projects using this package