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:
dart
class A {}
The following code produces this diagnostic because a.dart
doesn't
contain a part-of directive:
dart
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:
dart
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:
dart
import 'a.dart';
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。