- [flutter]Error: The method 'showSnackBar' isn't defined for the class 'ScaffoldState'. 목차
- 문제해결
반응형
유튜브에서 프로그램을 따라 하다 보니, 이런 에러가 나타났습니다.
flutter 버전이 올라가면서 지금은 지원하지 않는 문장이 되었기 때문입니다.

에러가 나온 전체 모습입니다.
문제해결

ScaffoldMessenger.of(context).showSnackBar(SnackBar
위처럼 명령어가 변경되었습니다.

하단에 snackbar 메시지가 출력되었습니다.
반응형
'flutter' 카테고리의 다른 글
[flutter]Invalid child element in a block mapping (0) | 2023.11.05 |
---|---|
[Flutter]ElevatedButton()의 Style 만들기 (0) | 2023.11.04 |
[flutter]The argument type 'MaterialColor' can't be assigned to the parameter type 'MaterialStateProperty<Color> (0) | 2023.10.22 |
[Flutter]Try removing 'const' from the constructor invocation. (0) | 2023.10.21 |
[flutter]Error: Constant evaluation error (0) | 2023.10.21 |