Skip to content

Instantly share code, notes, and snippets.

@vlasentiy
Created September 3, 2020 12:08
Show Gist options
  • Save vlasentiy/a474cf2086eed3b013cf1eeb3dbcc0c0 to your computer and use it in GitHub Desktop.
Save vlasentiy/a474cf2086eed3b013cf1eeb3dbcc0c0 to your computer and use it in GitHub Desktop.
example1
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
Future<Widget> build(context) async {
var data = await callAsyncFetch();
return Text(data); // doesn't work either
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment