次のimport文で掲題の様なエラーが発生している場合の対処法:
import ‘package:webview_flutter_android/webview_flutter_android.dart‘;
エラー)
The imported package ‘webview_flutter_android‘ isn’t a dependency of the importing package.

対処法)
①flutter pub deps で依存関係を確認する。
> flutter pub deps ※ここでパイプでtxtファイルに出力しておくと後で確認し易い。
例:
└── webview_flutter 4.4.4 ←※これは既にインストール済
├── flutter…
├── webview_flutter_android 3.13.2 ←☆未インストール
│ ├── flutter…
│ └── webview_flutter_platform_interface…
※flutter pub deps
コマンドの結果を見ると、webview_flutter_android
パッケージが webview_flutter
の依存関係の一部として正しくインストールされていることがわかります。これは、webview_flutter
パッケージのバージョン 4.4.4
が webview_flutter_android
のバージョン 3.13.2
に依存していることを示しています。
②pubspec.yaml で上記パッケージを確認する。


③https://pub.dev/ で、上記Packageを検索し、上記依存関係と一致しているバージョンのPackageをインストールする。
例:
> flutter pub add webview_flutter_android

結果:


エラーが消えました。