Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BuilderLoading extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- TenderApiProvider apiProv = Provider.of<TenderApiProvider>(context);
- // apiProv.getToken();
- return StreamBuilder<ApiKeyLoadingState>(
- stream: apiProv.streamApiKeyController.stream, // here
- builder: (BuildContext context, AsyncSnapshot<ApiKeyLoadingState> snapshot)
- {
- switch (apiProv.apiKeyLoadingState) {
- case ApiKeyLoadingState.Progress:
- return Text("Retreiving key");
- case ApiKeyLoadingState.Done:
- return HomePage();
- case ApiKeyLoadingState.Error:
- return Text("Key Got Error");
- break;
- default:
- return Text("Unknown");
- }
- }
- );
- }
- }
- return (
- builder: (BuildContext context, AsyncSnapshot<ApiKeyLoadingState> snapshot)
- {
- // ... streamApiKeyController
- }
- builder: (BuildContext context, AsyncSnapshot<regionsLoadingState> snapshot)
- {
- // ... streamRegionsLoadingController
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement