implementation_ imports
Import of a library in the 'lib/src' directory of another package.
Description
#
The analyzer produces this diagnostic when an import references a library
that's inside the
lib/src
directory of a different package, which
violates
the convention for pub
packages.
Example
#
The following code, assuming that it isn't part of the
ffi
package,
produces this diagnostic because the library being imported is inside the
top-level
src
directory:
import 'package:ffi/src/allocation.dart';
Common fixes
#If the library being imported contains code that's part of the public API, then import the public library that exports the public API:
import 'package:ffi/ffi.dart';
If the library being imported isn't part of the public API of the package, then either find a different way to accomplish your goal, assuming that it's possible, or open an issue asking the package authors to make it part of the public API.
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.