Dart Analyze logoDart Analyze/
DRT-W1177

The keyword 'final' isn't necessary because the parameter is implicitly 'final'DRT-W1177

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when either a field initializing parameter or a super parameter in a constructor has the keyword final. In both cases the keyword is unnecessary because the parameter is implicitly final.

Examples

The following code produces this diagnostic because the field initializing parameter has the keyword final:

class A {
  int value;

  A(final this.value);
}

The following code produces this diagnostic because the super parameter in B has the keyword final:

class A {
  A(int value);
}

class B extends A {
  B(final super.value);
}

Common fixes

Remove the unnecessary final keyword:

class A {
  A(int value);
}

class B extends A {
  B(super.value);
}