'Failed assertion: line 5219 pos 14: '_dependents.isEmpty': is not true

I have an error when I navigate to another page using getx Here is my error: _AssertionError ('package:flutter/src/widgets/framework.dart': Failed assertion: line 5219 pos 14: '_dependents.isEmpty': is not true.)

My file main:

void main() async {
  Get.put(AuthService()).init();
  runApp(
    GetMaterialApp(
      debugShowCheckedModeBanner: false,
      initialRoute: Routes.SPLASH,
      defaultTransition: Transition.fade,
      theme: appThemeData,
      initialBinding: SplashBinding(),
      getPages: AppPages.pages,
      home: const SplashPage(),
    ),
  );
}

My first page:

class DashboardPage extends StatelessWidget {
  const DashboardPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetBuilder<DashboardPageController>(
      init: DashboardPageController(),
      builder: (controller) {
        return Scaffold(
          body: SafeArea(
            child: IndexedStack(
              index: controller.tabIndex,
              children: [
                HomePage(),
                ChatPage(),
                PostPage(),
                NotificationPage(),
                ProfilePage(),
              ],
            ),
          ),
          floatingActionButton: FloatingButton(isVisible: true, id: 5),
          bottomNavigationBar: BottomNavigationBar(
            unselectedItemColor: Colors.black,
            selectedItemColor: Colors.redAccent,
            onTap: controller.changeTabIndex,
            currentIndex: controller.tabIndex,
            showSelectedLabels: false,
            showUnselectedLabels: false,
            type: BottomNavigationBarType.fixed,
            backgroundColor: Colors.white,
            elevation: 0,
            items: [
              _bottomNavigationBarItem(
                icon: Icons.home,
                label: 'Home',
              ),
              _bottomNavigationBarItem(
                icon: Icons.chat_bubble,
                label: 'Chat',
              ),
              _bottomNavigationBarItem(
                icon: Icons.add_box,
                label: 'Post',
              ),
              _bottomNavigationBarItem(
                icon: Icons.notifications_active,
                label: 'Notification',
              ),
              _bottomNavigationBarItem(
                icon: Icons.person,
                label: 'Profile',
              ),
            ],
          ),
        );
      },
    );
  }
}

Second page:

class CreatePostPage extends StatelessWidget {
  const CreatePostPage({Key? key}) : super(key: key);
  static String route = '/postpage';

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      home: GetBuilder<PostController>(
          tag: "post1",
          init: PostController(),
          builder: (controller) {
            return Scaffold(
              backgroundColor: backgroundColor,
              appBar: AppBar(
                leading: InkWell(
                  onTap: () {
                    Get.back();
                  },
                  child: const Icon(
                    Icons.arrow_back_ios,
                    color: accentColor,
                  ),
                ),
                title: const Text(
                  'Create post',
                  style: TextStyle(color: accentColor),
                ),
                backgroundColor: backgroundColor,
                elevation: 0,
              ),
            );
          }),
    );
  }
}

class CreatePostBody extends StatefulWidget {
  const CreatePostBody({Key? key}) : super(key: key);

  @override
  _CreatePostBodyState createState() => _CreatePostBodyState();
}

class _CreatePostBodyState extends State<CreatePostBody> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: SingleChildScrollView(
        child: Center(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              _buildPostTop(),
              _buildPostMiddle(
                  'Add a location..',
                  const Icon(
                    Icons.location_on,
                    color: Colors.white,
                  ),
                  null),
              _buildPostMiddle(
                  'Tag some friend..',
                  const Icon(
                    Icons.people,
                    color: Colors.white,
                  ),
                  null),
              _buildPostMiddle(
                  'Add a image..',
                  const Icon(
                    Icons.image,
                    color: Colors.white,
                  ),
                  null),
              const SizedBox(
                height: 200,
              ),
              Container(
                margin: const EdgeInsets.only(right: 10),
                child: SignUpButton(
                    text: 'Post',
                    height: 56,
                    width: MediaQuery.of(context).size.width,
                    fontSize: 20.0,
                    onTap: null),
              )
            ],
          ),
        ),
      ),
    );
  }

I'm a newbie in flutter, please help me solve this problem



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source