toJson method

Map toJson()

Implementation

Map toJson() {
  Map _result = {};

  if (tag != null) _result.addAll({"tag": tag});
  if (exception != null) _result.addAll({"exception": exception!.toJson()});
  if (!detections.isEmpty) {
    var list = [];
    for (var item in detections) list.add(item!.toJson());
    _result.addAll({"detections": list});
  }
  if (!results.isEmpty) {
    var list = [];
    for (var item in results) list.add(item!.toJson());
    _result.addAll({"results": list});
  }

  return _result;
}