Skip to main content

avoid-double-slash-imports

added in: 1.6.0
🛠
Pro+
preset: recommended

Warns when an import/export directive contains a double slash.

Double slash in the URI is considered valid, but under some circumstances the program won't run.

Example

❌ Bad:

import 'package:test//material.dart'; // LINT: Avoid import/export directives with double slashes.
import '../../..//rule_utils_test.dart'; // LINT: Avoid import/export directives with double slashes.

export 'package:mocktail//good_file.dart'; // LINT: Avoid import/export directives with double slashes.

part '../../..//individual/rules/empty.dart'; // LINT: Avoid import/export directives with double slashes.

✅ Good:

import 'package:test/material.dart'; // Correct, no double slashes
import 'package:mocktail/good_file.dart';
import '../../../rule_utils_test.dart';

export 'package:mocktail/good_file.dart';

part '../../../individual/rules/empty.dart';

Additional Resources