모바일개발/플러터
[flutter] 플러터 if문 switch문 사용하기(즉시 실행 함수 표현식)
플러터 코딩을 하다 보면 if문이나 switch문을 쓰고 싶을 때가 있습니다. 하지만 삼항 연산자 대신에 if문을 쓰려고 하면 에러가 나는 경우가 있습니다. 플러터에서 if과 switch문을 쓰는 법에 대해 알아보겠습니다. 삼항 연산자를 쓰는 경우(정상 사용 가능) class HelloScrren extends StatelessWidget { const HelloScrren({ Key? key }) : super(key: key); @override Widget build(BuildContext context) { const ko = 'ko'; return Scaffold( appBar: AppBar(title: const Text('test')), body: const Center( child: ( k..
2022. 3. 24. 15:48
최근댓글