convert below kotlin code to the dart

public class JSONObject {

 private static
 final class Null {

 @Override
 protected final Object clone()
 {
 return this;
 }

 @Override
 public boolean equals(Object
 object) {
 return
 object == null ||
 object == this;
 }

 @Override
 public int hashCode()
 {
 return 0;
 }

 @Override
 public String toString()
 {
 return "null";
 }
 }

 private final Map map;
 public static final Object NULL = new Null();
 public JSONObject()
 {
 this.map = new HashMap < String, Object>();
 }

 public JSONObject(JSONObject jo, String[] names)
 {
 this(names.length);
 for (int i = 0; i < names.length; i += 1) {
 try {
 this.putOnce(
 names[i
 ], jo.opt(
 names[i
 ]
 )
 );
 } catch (Exception ignore) {}
 }
 }

 public JSONObject(JSONTokener x) throws JSONException
 {
 this();
 char c;
 String key;

 if (x.nextClean() != '{') {
 throw x.syntaxError("A JSONObject text must begin with '{'");
 }
 for (;;) {
 c = x.nextClean();
 switch(c) {
 case 0:
 throw x.syntaxError("A JSONObject text must end with '}'");
 case '
 }':
 return;
 default:
 x.back();
 key = x.nextValue().toString();
 }

 c = x.nextClean();
 if (c != ':') {
 throw x.syntaxError("Expected a ':' after a key");
 }

 if (key != null) {
 if (this.opt(key) != null) {
 throw x.syntaxError("Duplicate key \"" + key + "\"");
 }
 Object value = x . nextValue ();
 if (value != null) {
 this.put(key, value);
 }
 }

 switch(x.nextClean()) {
 case ';':
 case ',':
 if (x.nextClean() == '
 }') {
 return;
 }
 x.back();
 break;
 case '
 }':
return;
default:
throw x.syntaxError("Expected a ',' or '}'");
 }
}
}

public JSONObject(Map m) {
 if (m == null) {
 this.map = new HashMap < String, Object>();
} else {
 this.map = new HashMap < String, Object>(m.size());
 for (final Entry e : m.entrySet()) {
 final Object value = e.getValue();
 if (value != null) {
 this.map.put(String.valueOf(e.getKey()), wrap(value));
 }
 }
}
}

public JSONObject(Object bean) {
 this();
 this.populateMap(bean);
}

public JSONObject(Object object, String names[]) {
 this(names.length);
 Class c = object.getClass();
 for (int i = 0; i < names.length; i += 1) {
 String name = names [i
 ];
 try {
 this.putOpt(name, c.getField(name).get(object));
 } catch (Exception ignore) {}
}
}

public JSONObject(String source) throws JSONException {
 this(new JSONTokener (source));
}

public JSONObject(String baseName, Locale locale) throws JSONException {
 this();
 ResourceBundle bundle = ResourceBundle . getBundle (baseName, locale,
 Thread.currentThread().getContextClassLoader());

 Enumeration keys = bundle . getKeys ();
 while (keys.hasMoreElements()) {
 Object key = keys . nextElement ();
 if (key != null) {

 String[] path =((String) key).split("\\.");
 int last = path . length -1;
 JSONObject target = this;
 for (int i = 0; i < last; i += 1) {
 String segment = path [i
 ];
 JSONObject nextTarget = target . optJSONObject (segment);
 if (nextTarget == null) {
 nextTarget = new JSONObject ();
 target.put(segment, nextTarget);
 }
 target = nextTarget;
 }
 target.put(
 path[last
 ], bundle.getString((String) key)
 );
 }
}
}

protected JSONObject(int initialCapacity){
 this.map = new HashMap < String, Object>(initialCapacity);
}

public JSONObject accumulate(String key, Object value ) throws JSONException {
 testValidity(value);
 Object object = this.opt(key);
 if (object == null) {
 this.put(
 key,
 value instanceof JSONArray ? new JSONArray().put(value)
 : value);
} else if (object instanceof JSONArray) {
 ((JSONArray) object).put(value);
} else {
 this.put(key, new JSONArray ().put(object).put(value));
}
 return this;
}

public JSONObject append(String key, Object value ) throws JSONException {
 testValidity(value);
 Object object = this.opt(key);
 if (object == null) {
 this.put(key, new JSONArray ().put(value));
} else if (object instanceof JSONArray) {
 this.put(key, ((JSONArray) object).put(value));
} else {
 throw new JSONException ("JSONObject[" + key
 + "] is not a JSONArray.");
}
 return this;
}

public static String doubleToString(double d) {
 if (Double.isInfinite(d) || Double.isNaN(d)) {
 return "null";
}
}
아래 코틀린 코드를 다트로 바꾸기public class JSONObject { private static final class Null { @Override 보호된 최종 객체 클론() { 이것을 반환합니다; } @Override 공용 부울 같음(Object object) { return object == null || object == this; } @Override public int hashCode() { 반환 0; } @Override public String toString() { 반환 "null"; } } 비공개 최종 Map map; public static final Object NULL = new Null(); public JSONObject() { this.map = 새로운 해시맵 < 문자열, 객체>(); } public JSONObject(JSONObject jo, String[] names) { this(names.length); for (int i = 0; i < names.length; i += 1) { try { this.putOnce( names[i ], jo.opt( names[i ] ) ); } catch (예외 무시) {} } } public JSONObject(JSONTokener x) throws JSONException { this(); char c; 문자열 키; if (x.nextClean() != '{') { throw x.syntaxError("JSONObject 텍스트는 '{'")로 시작해야 합니다; } for (;;) { c = x.nextClean(); switch(c) { case 0: throw x.syntaxError("JSONObject 텍스트는 '}'로 끝나야 합니다."); case ' }': return; default: x.back(); key = x.nextValue().toString(); } c = x.nextClean(); if (c != ':') { throw x.syntaxError("키 뒤에 ':'가 예상됩니다"); } if (key != null) { if (this.opt(key) != null) { throw x.syntaxError("중복 키 \"" + key + "\""); } 객체 값 = x . nextValue (); if (value != null) { this.put(키, 값); } } switch(x.nextClean()) { case ';': case ',': if (x.nextClean() == ' }') { return; } x.back(); break; case ' }':반환합니다;default:throw x.syntaxError("예상했던 ',' 또는 '}'"); }}}public JSONObject(Map m) { if (m == null) { this.map = 새로운 해시맵 < 문자열, 객체>();} else { this.map = new HashMap < String, Object>(m.size()); for (final Entry e : m.entrySet()) { 최종 객체 값 = e.getValue(); if (value != null) { this.map.put(String.valueOf(e.getKey()), wrap(value)); } }}}public JSONObject(Object bean) { this(); this.populateMap(bean);}public JSONObject(Object object, String names[]) { this(names.length); 클래스 c = object.getClass(); for (int i = 0; i < names.length; i += 1) { String name = names [i ]; try { this.putOpt(name, c.getField(name).get(object)); } catch (예외 무시) {}}}public JSONObject(String source) throws JSONException { this(new JSONTokener (source));}public JSONObject(String baseName, Locale locale) throws JSONException { this(); ResourceBundle 번들 = ResourceBundle . getBundle (baseName, locale, Thread.currentThread().getContextClassLoader()); 열거 키 = 번들 . getKeys (); while (keys.hasMoreElements()) { 객체 키 = keys . nextElement (); if (key != null) { String[] path =((String) key).split("\\."); int last = 경로 . 길이 -1; JSONObject target = this; for (int i = 0; i < last; i += 1) { String 세그먼트 = 경로 [i ]; JSONObject nextTarget = target . optJSONObject (세그먼트); if (nextTarget == null) { nextTarget = new JSONObject (); target.put(segment, nextTarget); } target = nextTarget; } target.put( path[last ], 번들.getString((문자열) 키) ); }}}protected JSONObject(int initialCapacity){{ this.map = new HashMap < String, Object>(initialCapacity);}public JSONObject accumulate(String key, Object value ) throws JSONException { testValidity(value); Object object = this.opt(key); if (object == null) { this.put( key, 값 인스턴스 오브 JSONArray ? 새로운 JSONArray().put(값) : value);} else if (object instanceof JSONArray) { ((JSONArray) 객체).put(값);} else { this.put(키, 새로운 JSONArray ().put(객체).put(값));} 이것을 반환합니다;}public JSONObject append(String key, Object value ) throws JSONException { testValidity(value); Object object = this.opt(key); if (object == null) { this.put(key, new JSONArray ().put(value));} else if (객체 인스턴스 오브 JSONArray) { this.put(key, ((JSONArray) object).put(value));} else { 새로운 JSONException을 던지십시오 ("JSONObject[" + 키 + "]는 JSONArray가 아닙니다.");} 이것을 반환합니다;}public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null";}}