Flutterで画像をピンチイン・アウトで拡大・縮小できる大変便利な「photo_view」という有名なパッケージがありますが、

このパッケージを使っているプロジェクトで画面遷移等を行った際に、
The following assertion was thrown while finalizing the widget tree: Looking up a deactivated widget's ancestor is unsafe. At this point the state of the widget's element tree is no longer stable. To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
というエラーが出てしまう場合があります(アプリは落ちないが)。
これは、photo_viewパッケージのissueにも上がっていているのですが、現時点(2022/4)ではまだ解決されていないようなので、以下の次善の策を施してやる必要があるようです。
(pubspec.yamlファイルの「dependency_override」欄に以下を追記)
dependency_overrides:
photo_view:
git:
url: https://github.com/bluefireteam/photo_view
ref: masterこの記事を書いた開発者に、直接相談できます
みんプロ式アプリ開発なんでも相談室
ストアの審査・ビルドエラー・Claude Codeでのアプリづくりまで。アプリの困りごとを一緒に解決する60分です。
60分のご相談|10,000円(税込)延長10分 1,500円
AIを相棒にして、やりたいことを形にしたい方はみんプロ式 AI相棒化相談室



