Skip to content
pubscout

undo

1.6.0, released 10 months ago by rodydavis.com

A clean and robust undo/redo library for Dart and Flutter using the Command Pattern.

WASM-ready
$ flutter pub add undo
Source repository

What it does

Provides a stack-based history mechanism to manage state changes. It lets you easily roll back or replay actions using individual or batched changes, as well as a SimpleStack for tracking a single state object.

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

Use it when

  • You need to add undo and redo functionality to a Flutter or Dart application.
  • You want a lightweight history stack that works with any state management architecture like ChangeNotifier, Bloc, or Riverpod.

Skip it when

  • You need an all-in-one state management framework rather than a dedicated undo/redo helper.

Strengths

  • Zero dependencies and minimal overhead
  • Supports batched and grouped changes
  • Flexible architecture that integrates with any state management solution

Weaknesses

  • Requires manual tracking of old state values and change logic

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:undo/undo.dart';

void main() {
  final changes = ChangeStack();
  var count = 0;

  changes.add(
    Change<int>(
      count,
      () => count++,
      (oldVal) => count = oldVal,
      description: 'Increment count',
    ),
  );

  changes.undo();
  changes.redo();
}

Alternatives

Packages that do the same job and could replace undo.