toReactive method
Creates a reactive set with custom middleware from this set.
This method is similar to reactive, but allows you to provide middleware to customize the behavior of the reactive set.
Parameters:
middlewares: A list of FluxivityMiddleware instances to apply to the reactive set.
Example:
// Create a reactive set with logging middleware
final selectedItems = {'item1', 'item3'}.toReactive(
middlewares: [LoggingMiddleware<Set<String>>()],
);
selectedItems.value.add('item4'); // This will be logged by the middleware
selectedItems.value = Set.from(selectedItems.value); // Trigger notification and logging
Implementation
Reactive<Set<E>> toReactive(
{List<FluxivityMiddleware<Set<E>>>? middlewares}) {
return Reactive<Set<E>>(Set<E>.from(this), middlewares: middlewares);
}