Flutter error : Undefined name 'ScaffoldMessenger'


Always getting this error on a project without any reason for the moment could you help me on this.

Undefined name ‘ScaffoldMessenger’.
Try correcting the name to one that is defined, or defining the name.

Flutter version : 1.22.5 stable

Could you help me on this please ?


According to https://flutter.dev/docs/release/breaking-changes (at the moment), under Not yet released to stable, we see SnackBars managed by the ScaffoldMessenger. So, it’s not in 1.22… it’ll be in the next release.

Answered By – Randal Schwartz

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published