unwrapStateProperty method

DartValue? unwrapStateProperty(
  1. DartValue? v
)

Unwraps WidgetStatePropertyAll(x) / MaterialStatePropertyAll(x).

Implementation

DartValue? unwrapStateProperty(DartValue? v) {
  final d = deref(v);
  if (d is ObjectValue &&
      (d.type == 'WidgetStatePropertyAll' ||
          d.type == 'MaterialStatePropertyAll')) {
    return d.arg(0);
  }
  if (d is CallValue &&
      d.method == 'all' &&
      d.target is RefValue &&
      const {
        'WidgetStateProperty',
        'MaterialStateProperty',
      }.contains((d.target as RefValue).last)) {
    return d.positional.firstOrNull;
  }
  return v;
}