# Obs<T> class abstract

A reactive wrapper for values, lists, or maps.

`Obs<T>` allows you to listen for changes to its internal value. It supports observing:

- Single values (`ValueChanged`)
- List mutations (`ListChange`)
- Map mutations (`MapChange`)
- Grouped events (`BulkChange`)

You can use it in state management, reactive UIs, or any situation where you need to react to changes in data structures.

### Example (basic value)

    final obs = Obs<int>(0);

    // Listen for changes
    obs.listen((event) {
      if (event is ValueChanged<int>) {
        print('Value changed from ${event.oldValue} to ${event.newValue}');
      }
    });

    obs.set(42);
    // Prints: Value changed from 0 to 42

### Example (list)

    final observableList = Obs<List<String>>([]);

    observableList.listen((event) {
      if (event is ListChange<String>) {
        print('List changed: $event');
      }
    });

    observableList.add('apple');
    observableList.add('banana');

### Example (map)

    final observableMap = Obs<Map<String, int>>({});

    observableMap.listen((event) {
      if (event is MapChange<String, int>) {
        print('Map changed: $event');
      }
    });

    observableMap.put('Alice', 10);
    observableMap.put('Bob', 20);

Annotations
  - @Generic(Obs)

## Constructors

Obs.new([T? initial])
  A reactive wrapper for values, lists, or maps.
  factory

## Properties

hashCode → int
  The hash code for this object.
  no setter inherited
runtimeType → Type
  A representation of the runtime type of the object.
  no setter inherited

## Methods

add<E>(E element) → void
  Add an element to the list.
addAll<E>(Iterable<E> iterable) → void
  Add multiple elements to the list.
clearList<E>() → void
  Clear all elements from the list.
clearMap<K, V>() → void
  Clear all key-value pairs in the map.
dispose() → Future<void>
  Dispose of this obs.
listen(void onData(ObsEvent)) → StreamSubscription<ObsEvent>
  Subscribe to change events.
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a nonexistent method or property is accessed.
  inherited
put<K, V>(K key, V value) → V?
  Insert or update a key-value pair in the map.
putAll<K, V>(Map<K, V> entries) → void
  Insert or update multiple key-value pairs in the map.
removeAt<E>(int index) → E
  Remove and return the element at `index`.
removeFromList<E>(E element) → bool
  Remove the first occurrence of `element` from the list.
removeFromListAny<E>(Object? element) → bool
  Remove the first occurrence matching `element` using equality.
removeKey<K, V>(K key) → V?
  Remove a key-value pair from the map by `key`.
replaceAllInList<E>(Iterable<E> items) → void
  Replace all elements in the list with `items`.
set(T? newValue, {bool force = false}) → void
  Replace the current value and emit a ValueChanged event.
toString() → String
  A string representation of this object.
  inherited
transaction<R>(R fn()) → R
  Perform multiple operations atomically.

## Operators

operator ==(Object other) → bool
  The equality operator.
  inherited