Skip to content
pubscout

map_history

1.0.7, released 7 weeks ago by an unverified publisher

A Map implementation with history and rollback support for entries, keys and values.

WASM-ready
$ flutter pub add map_history
Source repository

What it does

Provides a Map data structure that tracks changes and supports rolling back to previous versions using a version number. It allows efficient historical management of entries, keys, and values.

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

Use it when

  • You need undo/redo or version rollback capabilities for map-based data structures.
  • You want to track historical changes of keys and values without manual diffing.

Skip it when

  • You only need a standard Dart Map without history tracking overhead.
  • You need complex state management for UI components rather than just collection history.

Strengths

  • Built-in versioning and rollback functionality.
  • Optimized consolidation with performance improvements for changed keys.
  • Compatible with all standard Dart platforms.

Weaknesses

  • Adds memory and performance overhead compared to a standard Map due to history tracking.
  • Limited to map data structures.

Setup

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

void main() {
  var m = MapHistory<int, String>();

  m[1] = 'a';
  m[2] = 'b';
  m[3] = 'c';

  var ver3 = m.version;

  m[2] = 'B';
  m.remove(3);

  m.rollback(ver3);
}

Alternatives

Packages that do the same job and could replace map_history.

  • sortedmap

    A map of objects which can be sorted and filtered on both their key and value.

  • weak_map

    A map whose keys are weakly held, and cache functions for memoization.

  • cv

    Helpers to convert Dart objects to/from Map and JSON without code generation.

  • ttl_cache

    In‑memory key‑value store with optional time‑to‑live expiration for entries.

Works with

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