use_ string_ in_ part_ of_ directives
The part-of directive uses a library name.
Description
#
The analyzer produces this diagnostic when a
part of
directive uses a
library name to refer to the library that the part is a part of.
Example
#Given a file named lib.dart
that contains the following:
library lib;
part 'test.dart';
The following code produces this diagnostic because the
part of
directive uses the name of the library rather than the URI of the library
it's part of:
part of lib;
Common fixes
#Use a URI to reference the library:
part of 'lib.dart';
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.