我刚开始使用Provider程序包,并且已经在同一屏幕(/状态)上传递了基本数据。
但是我遇到问题使用提供程序包将数据从一个屏幕(路由)传递到另一屏幕 如果有人可以对此进行更多说明,我将不胜感激。
答案 0 :(得分:0)
MultiProvider(
providers: [
ChangeNotifierProvider(
create: (context) => Loader(),
),
ChangeNotifierProvider(create: (context) => SplashBlock()),
ChangeNotifierProvider(create: (context) => TermsBlock()),
ChangeNotifierProvider(create: (context) => InitialBlock()),
ChangeNotifierProvider(create: (context) => HomeBlock()),
ChangeNotifierProvider(create: (context) => AboutusBlock()),
ChangeNotifierProvider(create: (context) => EntryBlock()),
ChangeNotifierProvider(create: (context) => AllEventBlock())
],
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter',
theme: ThemeData(
fontFamily: 'OpenSans',
primaryColor: Colors.white,
primarySwatch: Colors.blue,
),
home:
Scaffold(
body:SplashScreen()
),
onGenerateRoute: Router.generateRoute,
));
Try with multiple provider . You can use data anywhere in-app.