flutter-getx-bottom-navigation-example
flutter-getx-bottom-navigation-example copied to clipboard
Null check operator used on a null value
return GetBuilder<DashBoardController>( builder: (controller) { return Scaffold( floatingActionButton: FloatingActionButton( onPressed: () { adController.showInterstitialAd(); }, child: Container( width: 60, height: 60, child: (Icon( Icons.search, size: 30, )), decoration: BoxDecoration( shape: BoxShape.circle, gradient: LinearGradient(colors: ColorUtilities.primaryGradiantColor), ), ), ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, body: SafeArea( child: IndexedStack( index: controller.tabIndex, children: [ HomeScreen(), WorkoutListScreen(), MealScreen(), ProfileScreen() ], ), ), bottomNavigationBar: BottomNavigationBar( onTap: controller.changeTabIndex, currentIndex: controller.tabIndex, items: [ BottomNavigationBarItem( icon: CustomImageView( imageUrl: controller.tabIndex == 0 ? AssetsUtilities.homeSelectedIcon : AssetsUtilities.homeIcon, )), BottomNavigationBarItem( icon: CustomImageView( imageUrl: controller.tabIndex == 1 ? AssetsUtilities.workOutSelectedIcon : AssetsUtilities.workoutIcon, )), BottomNavigationBarItem( icon: CustomImageView( imageUrl: controller.tabIndex == 2 ? AssetsUtilities.mealSelectedIcon : AssetsUtilities.mealIcon, )), BottomNavigationBarItem( icon: CustomImageView( imageUrl: controller.tabIndex == 3 ? AssetsUtilities.profileSelectedIcon : AssetsUtilities.profileIcon, )), ], ), ); }, );
Hi, I don't know if it is still important, so I have the same issue and the error has gone when I put this line of code:
init: BottomController(),
the whole thing looks like this:
@override
Widget build(BuildContext context) {
return GetBuilder<BottomController>(
init: BottomController(),
builder: (controller) {
return Scaffold(
body: SafeArea(
child: IndexedStack(
children: [
SettingsPage(),
Contracts(),
Reports(),
DescriptionEquip()
],
),
),
It should solve your problem I think