withContext<T> method
Run code with a specific transaction context
Implementation
Future<T> withContext<T>(
String transactionId,
Map<String, dynamic> attributes,
Future<T> Function() operation,
) async {
final context = TransactionContext(
transactionId: transactionId,
attributes: attributes,
);
pushContext(context);
try {
return await operation();
} finally {
popContext();
}
}