본문 바로가기
  • 포르쉐타고싶다
인포테인먼트 - development/flutter

[flutter-error] 에러 flutter: Error: Could not find the correct Provider<...> above this ~~ 해결

by 지오ㄴl 2020. 6. 19.

에러:

flutter: Error: Could not find the correct Provider<HotPlaceProvider> above this HotPlacePage Widget

To fix, please:

  * Ensure the Provider<HotPlaceProvider> is an ancestor to this HotPlacePage Widget
  * Provide types to Provider<HotPlaceProvider>
  * Provide types to Consumer<HotPlaceProvider>
  * Provide types to Provider.of<HotPlaceProvider>()
  * Ensure the correct `context` is being used.

해결

MainPage.dart에서 Multiprovider에 해당 Provider를 ChangeNotifierProvider로 등록한다

반응형

댓글