networkRequestSampling static method

Future<CxNetworkRequestSampling?> networkRequestSampling()

Asks native for the sampled flag of a request starting now. Resolves to null — send no header, echo nothing — when there is no answer: native not initialized, the bridge failing, or no reply within networkRequestSamplingTimeout. Never throws.

Implementation

static Future<CxNetworkRequestSampling?> networkRequestSampling() async {
  try {
    return await CxFlutterPluginPlatform.instance
        .networkRequestSampling()
        .timeout(networkRequestSamplingTimeout);
  } catch (e) {
    debugPrint('[Coralogix] networkRequestSampling: no answer ($e), '
        'sending without traceparent');
    return null;
  }
}