No named parameter with the name 'onPageChanged'. 에러가 출력되었을 때?
개발 중 CarouselSlider를 사용할 때 나는 에러였다.
기존 코드가 아래와 같았다면,
CarouselSlider(
items: images,
onPageChanged: (index) {
setState(() {
_currentPage = index;
_currentKeyword = keywords[_currentPage];
});
},
),
아래 코드 처럼 CarouselOptions를 추가해주니 해결되었다.
CarouselSlider(
items: images,
options: CarouselOptions(
onPageChanged: (index, reason) {
setState(() {
_currentPage = index;
_currentKeyword = keywords[_currentPage];
});
}
),
),
'개발 > Frontend' 카테고리의 다른 글
[리액트네이티브] React-Native UI Template (0) | 2023.04.21 |
---|---|
[리액트네이티브] React Native 주석 처리 방법 (0) | 2023.04.21 |
[Flutter] Flutter null safety 비활성화 ( can't have a value of 'null' because of its type but the implicit default value is 'null' 에러 해결) (0) | 2022.08.22 |
[Web] 쿼리스트링이란? (0) | 2021.10.17 |
[Web] http request, response 차이 (0) | 2021.10.15 |
댓글