addTrace method

Future<void> addTrace(
  1. Dio dio
)

add trace

Implementation

Future<void> addTrace(Dio dio) async {
  // 如果内存缓存为空, 则先从本地缓存读取
  if (_traceCacheValue == null) {
    _traceCacheValue = await _getLocalValue(_traceCacheKey);
  }

  if (_traceCacheValue != null && _traceCacheValue!.isNotEmpty) {
    dio.options.headers[_TRACE_HEADER] = _traceCacheValue;
  }
}