LoginSignup
0

More than 3 years have passed since last update.

Unhandled Exception: Navigator operation requested with a context that does not include a Navigator.

Posted at

生じたエラー

Unhandled Exception: Navigator operation requested with a context that does not include a Navigator.
訳:未処理の例外:ナビゲーターを含まないコンテキストでナビゲーター操作が要求されました。

原因

stackoverflowの回答欄を参考にしました。

現在の親ウィジェットがMaterialAppと同じレベルでないことを確認してください
MaterialAppで下位レベルのツリーのコンテキストを使用する

解決策

sample.dart

 void main() => runApp(MyApp()); //改良前

 void main() => runApp(MaterialApp(home: MyApp())); //改良後

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0