Skip to main content

simple_directive_paths

Details about the 'simple_directive_paths' diagnostic produced by the Dart analyzer.

Use simple directive paths.

Description

#

The analyzer produces this diagnostic when a directive uses a path that is not simple (for example, a path containing redundant ./ or backtracking ../ segments).

Example

#

Given a file named bar.dart in the lib/src directory:

dart
class Bar {}

The following code produces this diagnostic because it uses an unnecessarily complex relative URI:

dart
import './src/bar.dart';

void f(Bar b) {}

Common fixes

#

Use a minimal relative URI:

dart
import 'src/bar.dart';

void f(Bar b) {}