attach method

Context attach(
  1. Context? ctx, {
  2. String? token,
})

Implementation

Context attach(Context? ctx, {String? token}) {
  final resolved = ctx ?? context();
  final headers = <String, String>{
    ...resolved.getAttribute(headerKey),
    ...this.headers(),
  };
  if (token?.isNotEmpty ?? false) {
    headers[meshTokenHeader] = token!;
  }
  resolved.setAttribute(headerKey, headers);
  return resolved;
}