I want to create an app that has an authentication service
with different permissions and functions (e.g. messages) depending on the user role.
So I create
From version >=4.0.0, we need to do this a little differently from what @updatestage has answered.
return MultiProvider(
providers: [
ChangeNotifierProvider(builder: (_) => Auth()),
ChangeNotifierProxyProvider(
update: (context, auth, previousMessages) => Messages(auth),
create: (BuildContext context) => Messages(null),
),
],
child: MaterialApp(
...
),
);