DEV Community

Discussion on: Explain Futures and Streams in Dart like I'm Five

Collapse
 
bibibaafashion profile image
Bibibaa Fashion

I type
asyncRequest().then((result) => print(result));
and it works.

If I want to use result outside this line how to proceed?
I've tried this, but it didn't work:

String x;
asyncRequest().then((result) => x=result);
print (x);

It shows x=null;