doc_import_cannot_have_prefix
Doc imports can't have prefixes.
Description
#The analyzer produces this diagnostic when a documentation import has a prefix.
Using prefixes isn't supported for documentation imports.
Example
#The following code produces this diagnostic because the documentation import declares a prefix:
dart
/// @docImport 'package:meta/meta.dart' as a;
library;
Common fixes
#Remove the prefix:
dart
/// @docImport 'package:meta/meta.dart';
library;
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-06-23. View source or report an issue.