inheritFromWidgetOfExactType 플러터(flutter)
InheritedWidget이나 bloc패턴을 사용하다보면 inheritFromWidgetOfExactType을 자주 사용하게 되는데요. 코드를 입력하면 줄이 쭉 가있는데 더 이상 지원을 안 하는 것 같습니다.
해결 방법은 inheritFromWidgetOfExactType 대신 dependOnInheritedWidgetOfExactType으로 입력하면 됩니다.
static StoriesBloc of(BuildContext context) {
return (context.inheritFromWidgetOfExactType(StoriesProvider) as StoriesProvider).bloc;
}
▼
static StoriesBloc of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<StoriesProvider>().bloc;
}
예시코드
▼
오늘도 즐거운 하루되세요~
'플러터' 카테고리의 다른 글
플러터 Firebase AdMob - 빌드 단계에서 실행이 멈추는 오류 (0) | 2020.11.02 |
---|---|
플러터 유데미 강좌 후기 및 추천 (0) | 2020.10.31 |
플러터 스플래시 스크린(splash screen) 로딩 후 검은 화면이 나타나는 오류 (0) | 2020.05.06 |
안드로이드 NDK 설치 및 새로운 버전 추가 (1) | 2020.04.07 |
초보자 플러터 강좌 추천 (1) | 2020.03.11 |