Json.from constructor

Json.from(
  1. Json other, {
  2. bool initial = true,
})

Create Json from another

Implementation

Json.from(Json other, {bool initial = true}) {
  if (!initial) {
    _rawValue = other._rawValue;
    return;
  }

  if (other._rawValue is int ||
      other._rawValue is double ||
      other._rawValue is bool ||
      other._rawValue is String ||
      other._rawValue == null) {
    _rawValue = other._rawValue;
  } else if (other._rawValue is Map) {
    _rawValue = Map<String, dynamic>.from(other._rawValue as Map);
  } else if (other._rawValue is List) {
    _rawValue = List<dynamic>.from(other._rawValue as List);
  } else {
    assert(false);
  }
  exception = other.exception;
}