Skip to content

Instantly share code, notes, and snippets.

@Tajcore
Last active June 17, 2020 17:07
Show Gist options
  • Save Tajcore/a82015b26439ea9ec49911c9129fb733 to your computer and use it in GitHub Desktop.
Save Tajcore/a82015b26439ea9ec49911c9129fb733 to your computer and use it in GitHub Desktop.
void main() {
runApp(App());
}
class App extends StatefulWidget {
@override
_AppState createState() => _AppState();
}
class _AppState extends State<App> {
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider<AgentsManager>(create: (_) => AgentsManager()),
child: Consumer<AgentsManager>(builder: (context, agent, _) {
return ClientProvider(
uri: Provider.of<AgentsManager>(context).loaded
? Provider.of<AgentsManager>(context).httpLink
: "None", // The Agent Provider will have its httpLink attribute being able to change
child: MaterialApp( //But I need the app to rebuild in order for the changes to be seen elsewhere
debugShowCheckedModeBanner: false,
theme: manager.themeData,
initialRoute: '/',
routes: {
'/': (context) => LoginScreen(),
'/Homescreen': (context) => HomeScreen(),
'/Settings': (context) => SettingsScreen()
}));
});
}));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment