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 filePart fileA Dart source file that contains a `part of` directive. Learn more
uses a name to specify
the library that it's a part of.
Example
#
Given a part filePart fileA Dart source file that contains a `part of` directive. Learn more
named part_file.dart containing the following
code:
part of lib;
The following code produces this diagnostic because the library including the part filePart fileA Dart source file that contains a `part of` directive. Learn more doesn't have a name even though the part filePart fileA Dart source file that contains a `part of` directive. Learn more 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 filePart fileA Dart source file that contains a `part of` directive. Learn more
to specify its library
by URI:
part of 'test.dart';
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-4. View source or report an issue.