syncWithServerTime method

Future<bool> syncWithServerTime()

Call this function if you keep getting an error about server time

Implementation

Future<bool> syncWithServerTime() async {
  var response = await sendRequest(
    path: 'fapi/v1/time',
    type: RequestType.GET,
  );
  if (response.isRight) {
    int serverTime = response.right['serverTime'];
    timestampDifference = DateTime.now().millisecondsSinceEpoch - serverTime;
    return true;
  } else {
    return false;
  }
}