Skip to content

Instantly share code, notes, and snippets.

@sharmadhiraj
Created July 12, 2019 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharmadhiraj/cf1109173ec7f8e9a759847f8fbfb729 to your computer and use it in GitHub Desktop.
Save sharmadhiraj/cf1109173ec7f8e9a759847f8fbfb729 to your computer and use it in GitHub Desktop.
Flutter web app
//...........................................
body: FutureBuilder<String>(
future: fetchJoke(),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.active:
case ConnectionState.waiting:
return Center(child: CircularProgressIndicator());
case ConnectionState.done:
return Center(
child: Text(snapshot.hasError ? snapshot.error : snapshot.data,
style: TextStyle(fontSize: 22.0)),
);
}
},
),
//...........................................
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment