part_of_unnamed_library
The library is unnamed. A URI is expected, not a library name '{0}', in the part-of directive.
Description
#The analyzer produces this diagnostic when a library that doesn't have a
library
directive (and hence has no name) contains a part
directive
and the part of
directive in the part file uses a name to specify
the library that it's a part of.
Example
#Given a part file named part_file.dart
containing the following
code:
part of lib;
The following code produces this diagnostic because the library including the part file doesn't have a name even though the part file uses a name to specify which library it's a part of:
part 'part_file.dart';
Common fixes
#Change the part of
directive in the part file to specify its library
by URI:
part of 'test.dart';
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。