handleJsonData function

String handleJsonData(
  1. String text
)

Implementation

String handleJsonData(String text) {
  final jsonResult = jsonDecode(text);

  var markers = jsonResult['markers'] as List<dynamic>;
  if (markers.isNotEmpty) {
    var s = markers.length;
    var f = markers[0] as Map<String, dynamic>;
    var l = markers[s - 1] as Map<String, dynamic>;

    jsonResult['ip'] = f['tm'];
    jsonResult['op'] = l['tm'] + l['dr'] + 1;
  }

  return jsonEncode(jsonResult);
}