Home > database >  dashboard.dart parameter issue
dashboard.dart parameter issue

Time:04-23

In trying to run the Chrome build I receive the following error:

Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
lib/src/screens/Dashboard.dart:64:17: Error: No named parameter with the name 'title'.
                title: Text(
                ^^^^^
/usr/local/Caskroom/flutter/2.10.3/flutter/packages/flutter/lib/src/widgets/bottom_navigation_bar_item.dart:25:9: Context: Found this candidate, but the arguments don't match.
  const BottomNavigationBarItem({

In the code it's written like this:

bottomNavigationBar: BottomNavigationBar(
          items: <BottomNavigationBarItem>[
            BottomNavigationBarItem(
                icon: Icon(Fryo.shop),
                title: Text(
                  'Store',
                  style: tabLinkStyle,
                )),

I'm guessing this has to do with mobile vs. web version, so there may be a parameter I need to add where it overlooks this for the web version.

This is my first Flutter app and the code I'm using is a copy I'm using that is 3 years old, so I'm running into various issues when updating it. This particular issue may be because it was not built with a web version to begin with. Anyhow, any help would be appreciated.

CodePudding user response:

try label instead of title.

but only string not widget.

const BottomNavigationBarItem(
{required Widget icon,
String? label,
Widget? activeIcon,
Color? backgroundColor,
String? tooltip}
)

CodePudding user response:

The error is quite clear.

"No named parameter with the name 'title'", This means BottomNavigationBarItem has no title property

according to https://api.flutter.dev/flutter/widgets/BottomNavigationBarItem-class.html

you should use label property instead.

  • Related