skip to Main Content

enter image description herethis is the error occur.

bottomNavigationBar: BottomNavigationBar(
  items: const <BottomNavigationBarItem>[
    BottomNavigationBarItem(
      icon: Icon(
        Icons.home,
      ),
      title: Text(
        'Home',
      ),
    ),
    BottomNavigationBarItem(
      icon: Icon(
        Icons.message,
      ),
      title: Text(
        'Messages',
      ),
    ),
    BottomNavigationBarItem(
      icon: Icon(
        Icons.person,
      ),
      title: Text(
        'Profile',
      ),
    ),
  ],

),

enter image description here error code snippets

help for solve this problem.

3

Answers


  1. the problem is that there is no property title in the BottomNavigationBarItem, instead use label

    also the error in the first picture says, that label is equal to null

    Login or Signup to reply.
  2. Bro there’s not parameter with name ‘title’ in the BottomNavigationBarItem. you need to use label for giving the text in the BottomNavigationBarItem widget and it aspects string directly.

    So the updated code would look like this:

    bottomNavigationBar: BottomNavigationBar(
        items: const <BottomNavigationBarItem>[
          BottomNavigationBarItem(
              icon: Icon(
                Icons.home,
              ),
              label: 'Home',
          ),
          BottomNavigationBarItem(
            icon: Icon(
              Icons.message,
            ),
            label: 'Messages',
          ),
          BottomNavigationBarItem(
            icon: Icon(
              Icons.person,
            ),
            label: 'Profile',
          ),
        ],
      ),
    
    Login or Signup to reply.
  3. You should use label instead of title

    BottomNavigationBarItem

    The label

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search