postCall<T> method

Future<T> postCall<T>(
  1. String url, {
  2. required JSON data,
})
inherited

Implementation

Future<T> postCall<T>(String url, {required JSON data}) async {
  final dataString = jsonEncode(data);
  final uri = Uri.parse(url);

  String? apiKey;
  for (int i = 0; true; i++) {
    try {
      return await _postCall<T>(uri, apiKey: apiKey, data: dataString);
    } on RateLimitException {
      apiKey = _getApiKey(i);
      await Future.delayed(retryInterval);
    } catch (e) {
      rethrow;
    }
  }
}