Flutter error: "The argument type 'Text' can't be assigned to the parameter type 'String'."

Flutter error: "The argument type 'Text' can't be assigned to the parameter type 'String'."

我有以下代码是以前写的,必须更新。我将 title 更改为 label 以更新代码,但出现新错误:

      return BottomNavigationBar(
        onTap: (int index) => _homeScreenBloc.updatePageIndex(index),
        backgroundColor: Colors.white,
        type: BottomNavigationBarType.fixed,
        selectedFontSize: 12.0,
        unselectedFontSize: 12.0,
        selectedItemColor: Color(0xFF6BC076),
        unselectedItemColor: Color(0xFF8F8F91),
        iconSize: 26,
        currentIndex: _index,
        elevation: 0,
        items: <BottomNavigationBarItem>[
          BottomNavigationBarItem(
            label: Text(_titles[0]),
            icon: Icon(Icons.attach_money),
          ),
          BottomNavigationBarItem(
            label: Text(_titles[1]),
            icon: Icon(Icons.account_balance_wallet),
          ),
          BottomNavigationBarItem(
            label: Text(_titles[2]),
            icon: Icon(Icons.person_outline),
          ),
        ],
      );

错误信息是:

The argument type 'Text' can't be assigned to the parameter type 'String'.dartargument_type_not_assignable

我该如何解决这个问题?

如错误所述,您无法将文本小部件分配给字符串。标签参数采用字符串,而不是文本小部件。以下应该有效。

BottomNavigationBarItem(
        label: _titles[0],
        icon: Icon(Icons.attach_money),
      ),
      BottomNavigationBarItem(
        label: _titles[1],
        icon: Icon(Icons.account_balance_wallet),
      ),
      BottomNavigationBarItem(
        label: _titles[2],
        icon: Icon(Icons.person_outline),
      ),