closeScope method

  1. @override
Future<void> closeScope(
  1. LogScope scope, {
  2. required bool success,
  3. required Duration duration,
  4. Object? error,
  5. StackTrace? stackTrace,
})

Ends a scoped operation.

Implementation

@override
Future<void> closeScope(
  LogScope scope, {
  required bool success,
  required Duration duration,
  Object? error,
  StackTrace? stackTrace,
}) async {
  final holder = _holder;
  if (holder == null) return;

  final op = holder.state.activeOperations.remove(scope.id);
  if (op != null) {
    op.stopwatch.stop();
    holder.state.logHistory.add(
      CompletedOperation(
        label: op.label,
        success: success,
        duration: duration,
      ),
    );
  }
  holder.markDirty();
}