part_of_different_library
Expected this library to be part of '{0}', not '{1}'.
Description
#The analyzer produces this diagnostic when a library attempts to include a file as a part of itself when the other file is a part of a different library.
Example
#Given a file part.dart
containing
dart
part of 'library.dart';
The following code, in any file other than library.dart
, produces this
diagnostic because it attempts to include part.dart
as a part of itself
when part.dart
is a part of a different library:
dart
part 'package:a/part.dart';
Common fixes
#If the library should be using a different file as a part, then change the URI in the part directive to be the URI of the other file.
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。