Dart Analyze logoDart Analyze/
DRT-W1681

The '!' will have no effect because the receiver can't be nullDRT-W1681

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when the operand of the ! operator can't be null.

Example

The following code produces this diagnostic because x can't be null:

int f(int x) {
  return x!;
}

Common fixes

Remove the null check operator (!):

int f(int x) {
  return x;
}