Reputation: 115
Am having an issue, after updating my flutter I started to have a problem with the splashscreen which is giving me this error. widget.routeName must be a String beginning with forward slash (/) I have already updated the package but the error prevails.
class StartupView extends StatelessWidget {
final PushNotificationService _pushNotificationService =locator<PushNotificationService>();
@override
Widget build(BuildContext context) {
_pushNotificationService.initialise();
WidgetsFlutterBinding.ensureInitialized();
//Keep the app alive.
Wakelock.enable();
return ViewModelBuilder<StartupViewModel>.reactive(
/* onModelReady: (model) =>model.handleStartUpLogic(),*/
builder:(context, model, child) => SplashScreen(
seconds: 3,
navigateAfterSeconds:
model.userId==null ? LoginView():HomeView(userId: model.userId,),
title: new Text(
'Peças & Acessórios',
style: new TextStyle(
fontWeight: FontWeight.bold, color: Colors.white, fontSize: 25.0),
),
imageBackground: AssetImage('assets/images/otpImage.jpg'),
image: Image.asset('assets/images/logo.png'),
backgroundColor: Colors.white,
styleTextUnderTheLoader: new TextStyle(),
photoSize: 40.0,
onClick: () => print(""),
loaderColor: Colors.white,
),
viewModelBuilder: ()=>locator<StartupViewModel>(),
);
}
}
Upvotes: 0
Views: 903
Reputation: 51
check your splashScreen version :
splashscreen: ^1.3.3
and after add a rootName
argument in yours Splashscreen:
SplashScreen(
seconds: 3,
routeName: "/",
navigateAfterSeconds:
model.userId==null ? LoginView():HomeView(userId: model.userId,),
title: new Text(
'Peças & Acessórios',
style: new TextStyle(
fontWeight: FontWeight.bold, color: Colors.white, fontSize: 25.0),
),
imageBackground: AssetImage('assets/images/otpImage.jpg'),
image: Image.asset('assets/images/logo.png'),
backgroundColor: Colors.white,
styleTextUnderTheLoader: new TextStyle(),
photoSize: 40.0,
onClick: () => print(""),
loaderColor: Colors.white,
),
Upvotes: 5