Home > Enterprise >  It is necessary to start route name [splash_screen] with a slash: /splash_screen Flutter
It is necessary to start route name [splash_screen] with a slash: /splash_screen Flutter

Time:03-22

I am new to flutter. Searched everything over internet but not able to find solution.

Getting this error when I am running app

 It is necessary to start route name [splash_screen] with a slash: /splash_screen
 'package:get/get_navigation/src/routes/get_route.dart':
 Failed assertion: line 70 pos 16: 'name.startsWith('/')'

Here is main.dart code:-

 initialRoute: Routes.splashScreen,

And this is in routes.dart:-

  static final String splashScreen = "splash_screen";

CodePudding user response:

It seems this is a common mistake, if you are using OnGenerate and the named route you have to start with the "/pagename" manner so it should be like this

static final String splashScreen = "/splash_screen";

If this is your first page just do this one :

static final String splashScreen = "/";

CodePudding user response:

You need to write: static final String splashScreen = "/"

CodePudding user response:

For naming convention flutter uses Camel case standard like- camel_case and for Directory/package name- camelCase

  • Related