-
-
Save Vanethos/87d1629f7d1edde555661e866d635276 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SplashPage extends StatelessWidget { | |
final Completer<bool> completer; | |
SplashPage({this.completer, Key key}) : super(key : key); | |
@override | |
Widget build(BuildContext context) { | |
// Fetch some information from the internet. | |
// When finished, complete the Completer with the `true` value | |
// If there is an error, then | |
http.get('https://jsonplaceholder.typicode.com/todos/1').then((_) => | |
completer.complete(true)).catchError((_) => | |
completer.complete(false)); | |
return Material( | |
child: Container( | |
color: Colors.red, | |
child: Center( | |
child: CircularProgressIndicator(), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment