locationReport method

void locationReport({
  1. required String macAddress,
  2. required double proximity,
})

Implementation

void locationReport({required String macAddress, required double proximity}) {
  startSocket(prefs.read("token"));
  socket.io.options['extraHeaders'] = {
    'authorization': 'Bearer ${prefs.read("token")}'
  };
  socket.io
    ..disconnect()
    ..connect();

  Map<String, dynamic> json = {"beacon_id": macAddress};

  if (proximity >= 0.8) socket.emit("get_in", json);
  if (proximity <= 0.2) socket.emit("get_out", json);
}