toDart method

dynamic toDart()

Implementation

dynamic toDart() {
  if (_isBaseType(this)) {
    return _toBase(this);
  } else {
    var jsonstr = JSONStringify().string;
    try {
      if (jsonstr == null) {
        if (string != null && string != 'null' && string != 'undefined') {
          return jsonDecode(string!);
        }
      } else {
        return jsonDecode(jsonstr);
      }
    } catch (e, st) {
      Console.error(
        'toDart: exception=${e.toString()}, string=${string!}, jsonstr=$jsonstr, stacktrace=${st.toString()}',
      );
      return string;
    }
  }
}