toDart method

dynamic toDart()

Implementation

dynamic toDart() {
  if (_isBaseType(this)) {
    return _toBase();
  } else if (isObject) {
    return _objectToMap();
  } else if (isArray) {
    return _arrayToList();
  } else {
    var jsonStr = jsonString;
    if (jsonStr != null) {
      try {
        return jsonDecode(jsonStr);
      } catch (e, st) {
        Console.error(
          'toDart: ${e.toString()}, ${st.toString()}; jsonStr=$jsonStr; type=${type.value}',
        );
      }
    }
    return toString();
  }
}