resolveObject static method

Object? resolveObject(
  1. dynamic o
)

Resolve o to the related DSX.object of a DSX instance.

Implementation

static Object? resolveObject(dynamic o) {
  if (o == null) {
    return null;
  } else if (o is DSX) {
    return DSX.objectFromDSX(o);
  } else if (o is _DSXKey) {
    return DSX._objectFromKey(o);
  } else if (o is int) {
    var key = _DSXKey(o);
    return DSX._objectFromKey(key);
  } else if (o is String) {
    if (isDSXMark(o)) {
      var id = parseDSXMarkID(o)!;
      var key = _DSXKey(id);
      return DSX._objectFromKey(key);
    } else {
      var id = int.parse(o.trim());
      var key = _DSXKey(id);
      return DSX._objectFromKey(key);
    }
  }

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