Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //...........................................
- 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)),
- );
- }
- },
- ),
- //...........................................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement