DeepSource has joined Harness. Learn more
Dart Analyze logoDart Analyze/
DRT-W1562

Missing part-of directive in included fileDRT-W1562

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when a part directive is found and the referenced file doesn't have a part-of directive.

Example

Given a file a.dart containing:

class A {}

The following code produces this diagnostic because a.dart doesn't contain a part-of directive:

part 'a.dart';

Common fixes

If the referenced file is intended to be a part of another library, then add a part-of directive to the file:

part of 'test.dart';

class A {}

If the referenced file is intended to be a library, then replace the part directive with an import directive:

import 'a.dart';