toRaw<T> function

T toRaw<T>(
  1. T value
)

Converts a reactive object to its raw value.

If the input value is a reactive object, this function recursively unwraps it to get the underlying raw value. If the input is not reactive, it is returned as-is.

Example

final value = {1, 2}
final raw = toRaw(reactiveSet(value));

print(value == raw); // Prints: true

Implementation

T toRaw<T>(T value) {
  if (value is private.Reactive) {
    return toRaw(value.raw);
  }

  return value;
}