# Obs<T> constructor

Obs<T>([

1. T? initial

])

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);

## Implementation

    factory Obs([T? initial]) => _Obs(initial);