reactive_data_set 0.0.2
reactive_data_set: ^0.0.2 copied to clipboard
A Reactive Data Manager for Flutter and Dart inspired by Delphi's TDataSet.
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.