part_of_non_part
The included part '{0}' must have a part-of directive.
Description
#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';
Unless stated otherwise, the documentation on this site reflects Dart 3.7.3. Page last updated on 2025-05-08. View source or report an issue.