Skip to content

avoid_unnecessary_extends

v1.0.0 Warning Code Organization

This rule flags a class that explicitly extends Object.

Every Dart class extends Object already, so the clause states the default while looking like a decision. A reader who sees an extends expects the superclass to matter, and has to recall that this one does not.

A class extending a user-declared Object that shadows dart:core’s is making a real choice, and is left alone.

See also: Object

class Repository extends Object {}
class Repository {}

This rule is in the opinionated preset.

To disable this rule:

many_lints.yaml
rules:
avoid_unnecessary_extends: false

To keep the rule on but skip certain paths, use per-rule exclude.