extends_object_written_out
Reports extends Object on a class and on Object on a mixin. Delete the clause.
- Tier
- advisory
- Scope
- Dart
- Lowest preset
- recommended
- Fix
- deletes the clause
What it reports
Section titled “What it reports”extends Object on a class and on Object on a mixin, where Object is that of dart:core. The violation is on the clause.
It does not report:
- the bound
Object?of a type parameter. Without a bound, a type parameter becomesdynamicwhere a type argument is left out; with that bound it becomesObject?, so the two are not the same. - the bound
Object; - a class named
Objectdeclared in your own code.
Every class extends Object and every mixin applies to it, so the clause says nothing.
Example
Section titled “Example”Violating
class Plain extends Object {}Corrected
class Plain {}Rule parameters
Section titled “Rule parameters”Set under the assay: key of the project’s root analysis_options.yaml.
| Rule parameter | Default | Effect |
|---|---|---|
enabled |
true |
false switches the rule off for the whole project. |
exclude |
[] |
Path globs where the rule is silent. |
Suppressing it
Section titled “Suppressing it”Write why on the line directly above the suppression:
// Why it stays as written here.// ignore: extends_object_written_out// ignore_for_file: assay/extends_object_written_out silences it in a whole file, and // ignore: assay/extends_object_written_out with the prefix works too. See Suppressions.