https://blog.csdn.net/xdhc304/article/details/90232723
Flutter very concise syntax for asynchronous tasks, just use asyc and awai cooperation can achieve, how to understand these two keywords, look at the sections of the code
// the HTTP get request return value Future <String> type, i.e., the return value is a future value of type String Future <String> the getData () the async { // the async keyword statement Inside the function code needs to delay the execution of return http.get the await (Uri.encodeFull (URL), headers: { "the Accept": "file application / JSON"}); // the await keyword statement delays execution of operation, and then return operation result }
We can define an asynchronous function, but when we call the function we should pay attention
Since the return type of object is a Future,