
플러터에서 특정 조건에 따라 위젯을 나타내고 싶은 경우가 있다. 이때 일반적으로 사용하는 if() {} 문을 사용하니 if (_bannerAd != null) { SizedBox( height: 50, child: AdWidget(ad: _bannerAd!), ), }, error: The element type 'Set' can't be assigned to the list type 'Widget'. (list_element_type_not_assignable at [prayer_notebook] lib/ad_test.dart:76) 에러 내용은 Widget 타입이어야 하는데, Set가 되어서 발생한 에러라고 한다. 음? Set라고? 나는 분명 그냥 SizedBox인데?라고생각했는데 그 이유는 If()..
Flutter
2023. 7. 15. 09:11
공지사항