resolveDSX static method

DSX? resolveDSX(
  1. dynamic o
)

Resolve o to a DSX object.

Implementation

static DSX? resolveDSX(dynamic o) {
  if (o == null) {
    return null;
  } else if (o is DSX) {
    return o;
  } else if (o is _DSXKey) {
    return DSX._fromKey(o);
  } else if (o is int) {
    return DSX._fromKey(_DSXKey(o));
  } else if (o is String) {
    if (isDSXMark(o)) {
      var id = parseDSXMarkID(o)!;
      return DSX._fromKey(_DSXKey(id));
    } else {
      var id = int.parse(o.trim());
      return DSX._fromKey(_DSXKey(id));
    }
  }

  throw StateError("Can't resolve: $o");
}