shallowRef<T> function

ShallowRef<T> shallowRef<T>(
  1. T value
)

Creates a shallow ref - only .value access is reactive.

Unlike ref, the inner value is stored and exposed as-is, and will not be made deeply reactive.

Example:

final state = shallowRef({'count': 1});

// Does NOT trigger effects (shallow)
state.value['count'] = 2;

// DOES trigger effects (value replacement)
state.value = {'count': 2};

Implementation

ShallowRef<T> shallowRef<T>(T value) => ShallowRef<T>(value);