Skip to content

Instantly share code, notes, and snippets.

@vlasentiy
Last active September 3, 2020 12:06
Show Gist options
  • Save vlasentiy/dc136851ce235abcb807b60d13af65d1 to your computer and use it in GitHub Desktop.
Save vlasentiy/dc136851ce235abcb807b60d13af65d1 to your computer and use it in GitHub Desktop.
example0
import 'package:flutter/material.dart';
void main() =>
runApp(MaterialApp(home: Scaffold(body: Center(child: MyWidget()))));
Future<String> callAsyncFetch() =>
Future.delayed(Duration(seconds: 3), () => "hi bro !");
class MyWidget extends StatelessWidget {
@override
Widget build(context) {
callAsyncFetch().then((data) {
return Text(data); // doesn't work
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment