toJson method

Map toJson()

Implementation

Map toJson(){
  Map _result = {};

  if (detection != null) _result.addAll({"detection": detection!.toJson()});
  if (scenario != null) _result.addAll({"scenario": scenario});
  if (error != null) _result.addAll({"error": error!.toJson()});
  if (!allDetections.isEmpty) {
    var list = [];
    for (var item in allDetections) list.add(item!.toJson());
    _result.addAll({"allDetections": list});
  }

  return _result;
}