Dart Analyze logoDart Analyze/
DRT-W1693

Unused stack trace parameter in catch blockDRT-W1693

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when the stack trace parameter in a catch clause isn't referenced within the body of the catch block.

Example

The following code produces this diagnostic because stackTrace isn't referenced:

void f() {
  try {
    // ...
  } catch (exception, stackTrace) {
    // ...
  }
}

Common fixes

If you need to reference the stack trace parameter, then add a reference to it. Otherwise, remove it:

void f() {
  try {
    // ...
  } catch (exception) {
    // ...
  }
}