calculateMessages function

Future<Map<String, dynamic>> calculateMessages()

Implementation

Future<Map<String, dynamic>> calculateMessages() async {
  String messages = "";
  const String api = "/calculate_messages";
  final messageRecords = await getRecords("mobileMoney");
  messageRecords.items.forEach((element) async {
    messages = element.data['messages'];
  });
  final response = await dio.post(api, data: {"msg": messages});
  if(response.statusCode==200){
    await showMsgSuccess("Mobile Money", "Successfully calculated and analysed");
  }
  print(response.data);
  return response.data;
}