signals-dart

Design fine-grained reactive state architectures in Dart using signals_core primitives.

803|85|Updated Nov 18, 2023
One-click install
npx skills add https://github.com/rodydavis/signals.dart --skill signals-dart
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: signals-dart
Source: https://github.com/rodydavis/signals.dart/tree/main/skills/signals-dart
Command: npx skills add https://github.com/rodydavis/signals.dart --skill signals-dart

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Signals-dart helps you design predictable, high-performance reactive state in Dart without unnecessary recomputation or UI churn by giving you advanced primitives for synchronous, asynchronous, and collection-driven reactivity.

Core Features & Use Cases

  • Fine-grained reactivity with lazy evaluation: Use signal, computed, and effect to derive state and run side effects only when relevant dependencies change.
  • Async reactive state composition: Model loading/value/error lifecycles with futureSignal, streamSignal, computedAsync, and aggregate multiple async sources via computedFrom.
  • Reactive collections for granular updates: Use listSignal, setSignal, mapSignal, iterableSignal, and queueSignal to track mutations and trigger observers appropriately.
  • State utilities for real applications: Apply linkedSignal for writable derived state overrides, trackedSignal for undo/redo history, timerSignal for periodic ticks, and connect for piping events into signals.
  • Value semantics via options: Configure behavior using options classes (with copy/equality semantics) such as SignalOptions, ComputedOptions, AsyncSignalOptions, and collection-specific options.

Quick Start

Use the signals-dart skill to design a reactive counter with batch updates, a derived computed label, and an effect that logs changes while avoiding circular subscriptions.

Frequently Asked Questions about signals-dart

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is fine-grained reactive state management in Dart?

Fine-grained reactive state in Dart uses signals to track dependencies dynamically, ensuring computed values and side effects only re-evaluate when underlying dependencies change. This lazy evaluation prevents unnecessary recomputation and UI churn compared to coarse-grained state updates.

How do I handle async loading and error states reactively in Dart?

You can model async loading, value, and error lifecycles using futureSignal, streamSignal, and computedAsync. To aggregate multiple async sources without race corruption, compose them using computedFrom for predictable async reactive state.

How do I batch multiple signal updates to avoid redundant UI rebuilds?

Use the batch function to group multiple signal writes transactionally. This defers dependency tracking and effect execution until the batch completes, ensuring derived computed values and UI observers only update once after all writes are applied.

Can I track granular mutations in reactive Dart collections?

Yes, use listSignal, setSignal, mapSignal, iterableSignal, and queueSignal to track specific mutations within collections. These wrappers trigger observers appropriately based on granular changes rather than replacing the entire collection reference.

Does Dart reactive state support undo and redo history tracking?

Yes, use trackedSignal to maintain undo and redo history for reactive state. Additionally, linkedSignal allows writable derived state overrides, enabling persistent user modifications while preserving the underlying computed relationship.

What's the best way to read a Dart signal value without triggering dependency tracking?

Use the .peek() method to read a signal's current value without establishing a dependency relationship. This prevents unnecessary recomputation in computed functions, whereas reading via .value actively subscribes the current context to future changes.