kome13 / MC_GM

0 stars 0 forks source link

"Non-nullable instance field" 에러 #5

Open kome13 opened 2 years ago

kome13 commented 2 years ago

// 원본 class Bottom extends StatelessWidget { Bottom({Key? key}) : super(key: key); ButtomNavigationProvider _bottomNavigationBar;

Non-nullable instance field ' 에러코드 " must be initialized. Try adding an initializer expression, or add a field initializer in this constructor, or mark it 'late'. "

  1. 원인

  2. 해결방안

    오류코드 앞에 "late" 사용

class Home extends StatelessWidget { Home({Key? key}) : super(key: key); late ButtomNavigationProvider _bottomNavigationBar;