createContext static method

CausalityContext createContext(
  1. String description
)

Creates and returns a new CausalityContext without forking a Zone.

Use this when you need a context object (e.g. to store in a request's extra map) but don't want to fork the current Zone.

Implementation

static CausalityContext createContext(String description) {
  final parentContext = currentContext();
  return CausalityContext(
    eventId: _uuid.v4(),
    parentEventId: parentContext?.eventId,
    originDescription: description,
    timestamp: DateTime.now(),
  );
}