reactive_data_set

A simple yet powerful in-memory data manager for Flutter, inspired by Delphi's TDataSet.

ReactiveDataSet<T> provides a reactive, mutable, and easily sortable/filterable list structure that integrates seamlessly with native Flutter widgets like ValueListenableBuilder. It’s built to support common data manipulation use-cases in a clean and reusable way.


✨ Features

  • βœ… Generic, type-safe data holder (ReactiveDataSet<T>)
  • πŸ”„ Reactive UI updates using ValueNotifier<List<T>>
  • 🧹 Non-destructive filtering and sorting
  • βž• Insert, ✏️ update, ❌ delete, πŸ” reset, 🧽 clear operations
  • πŸ”’ Maintains original data intact while presenting filtered/sorted views
  • 🧩 Native Flutter-only (no external state management required)

🧠 Delphi TDataSet Inspiration

This package takes inspiration from Delphi's classic TDataSet component.

πŸ’‘ Unlike TDataSet, which was database-bound, ReactiveDataSet is purely in-memory and UI-friendly, perfect for modern reactive UIs. It embraces the spirit of data-awareness while staying lightweight and native.


πŸš€ Getting Started

1. Add the package

flutter pub add reactive_data_set

2. Define your data model

class Person {
  final String name;
  final int age;

  Person(this.name, this.age);
}

3. Create and use the data set

final dataSet = ReactiveDataSet<Person>([
  Person('Alice', 30),
  Person('Bob', 25),
]);

4. Bind to the UI

ValueListenableBuilder<List<Person>>(
  valueListenable: dataSet.dataListenable,
  builder: (context, people, _) {
    return ListView.builder(
      itemCount: people.length,
      itemBuilder: (_, index) => Text(people[index].name),
    );
  },
);

βš™οΈ API Overview

ReactiveDataSet<T>(
  [List<T>? initialData]
)

// Mutations
void insert(T item)
void delete(int index)
void update(int index, T updatedItem)

// Sorting & Filtering
void sort(Comparable Function(T) selector, {bool ascending = true})
void filter(bool Function(T) predicate)
void reset()
void clear()

// Access
List<T> get data
ValueNotifier<List<T>> get dataListenable

πŸ›£οΈ Roadmap (Future Ideas)

  • βͺ Undo/Redo stack for revertible operations
  • πŸ“¦ Batched updates/transactions
  • πŸ” Pagination and search helpers
  • πŸ”— Nested dataset support (parent/child relationships)
  • 🧾 JSON serialization helpers

πŸ›  Contributing

Feel free to open issues or pull requests for bugs, improvements, or new features. The goal is to keep it simple, fast, and native.

Built with ❀️ by a former Delphi developer for modern Flutter apps.


πŸ“„ License

MIT License. Use it freely in personal and commercial projects.

Libraries

reactive_data_set