getServerDelay method

Future<int> getServerDelay({
  1. required String config,
  2. String url = 'https://google.com/generate_204',
})

This method returns the real server delay of the configuration.

Implementation

Future<int> getServerDelay({required String config, String url = 'https://google.com/generate_204'}) async {
  try {
    if (jsonDecode(config) == null) {
      throw ArgumentError('The provided string is not valid JSON');
    }
  } catch (_) {
    throw ArgumentError('The provided string is not valid JSON');
  }
  return await FlutterV2rayPlatform.instance.getServerDelay(config: config, url: url);
}