avoid-duplicate-named-imports
- Group
- Correctness
- Path
lint/correctness/avoid-duplicate-named-imports- Default
- Off, opt in
- Origin
- Falcon
- Rule
- 53 of 512
Flags imports of the same library that differ only in their name prefix. Conditional URIs, deferred loading, combinators, and metadata must match. Consolidate uses under one import before removing the other directive.
Invalid
import 'a.dart' as first;
import 'a.dart' as second;
import 'b.dart';
import 'b.dart' as b;
import 'c.dart' as c;
import 'c.dart';
import 'd.dart' as d show D;
import 'd.dart' as other show D;
import 'e.dart' deferred as e;
import 'e.dart' deferred as otherE;
import 'f.dart' if (dart.library.io) 'io.dart' as f;
import 'f.dart' if (dart.library.io) 'io.dart' as otherF;import 'a.dart' as first;import 'a.dart' as second;import 'b.dart';import 'b.dart' as b;import 'c.dart' as c;import 'c.dart';import 'd.dart' as d show D;import 'd.dart' as other show D;import 'e.dart' deferred as e;import 'e.dart' deferred as otherE;import 'f.dart' if (dart.library.io) 'io.dart' as f;import 'f.dart' if (dart.library.io) 'io.dart' as otherF;Valid
import 'a.dart' as same;
import 'b.dart' as same;
import 'c.dart' as c show A;
import 'c.dart' as otherC show B;
import 'd.dart' as d hide A;
import 'd.dart' as otherD hide B;
import 'e.dart' as e;
import 'e.dart' deferred as otherE;
import 'f.dart' if (dart.library.io) 'io.dart' as f;
import 'f.dart' if (dart.library.html) 'html.dart' as otherF;
import 'g.dart' if (dart.library.io) 'one.dart' as g;
import 'g.dart' if (dart.library.io) 'two.dart' as otherG;
import 'plain.dart';
import 'plain.dart';Configure avoid-duplicate-named-imports
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"correctness": {
"avoid-duplicate-named-imports": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/correctness/avoid-duplicate-named-imports: <reason>More correctness rules
- avoid-duplicate-switch-case-conditionsrecommended
Flags repeated
whenguards on syntactically identical switch patterns. - avoid-duplicate-test-assertionsrecommendedtest
Reports repeated identical, side-effect-free assertions in a straight-line block.
- avoid-dynamic-calls
avoid_dynamic_callsrecommendedAvoid method calls or property accesses on a
dynamictarget. - avoid-emit-outside-blocrecommendedbloc
Flags external calls and tear-offs of a Bloc or Cubit's
emitmethod. - avoid-empty-setstaterecommendedflutter
Avoid setState callbacks with empty block bodies.
- avoid-empty-test-groupstest
Reports inline framework groups without any test registrations.
- avoid-global-state
avoid-global-stateDisallow mutable global and static state.
- avoid-hooks-outside-buildrecommendedflutter_hooks
Flags confirmed Flutter hooks outside hook builds, custom hooks, and HookBuilder/HookConsumer builders.