getBusTimeTable method
Returns a Map of <BusStop,BusTimeTable>
Implementation
Future<Map<String, List<BusTimeTable>>> getBusTimeTable() async {
var response = await fetch("busTimetable");
Map<String, List<BusTimeTable>> retmap = {};
Map<String, dynamic> tablemap = response != null
? (json.decode(response.body) as Map<String, dynamic>)
: [];
tablemap.forEach((key, value) {
List<dynamic> b = value["stops"];
List<BusTimeTable> bl =
b.map((element) => BusTimeTable.fromJson(element)).toList();
retmap[key] = bl;
});
return retmap;
}