Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Current behavior The current asynchronous login sample code has the following issues: 1. The `main` function tries to use `await userName()`, but `userName` is a string variable, not a function. 2. the `login` function should be called and `await` should be used to wait for its result. ### Expected behavior The `main` function should correctly call the `login` function and use `await` to wait for the result, then print out the username. ### Sample code Here is the corrected code: ```dart Future<String> login() { String userName = "Temidjoy"; return Future.delayed( Duration(seconds: 4), () => userName ). } main() async { print('Authenticating please wait...') The String result = await login(); String result = await login(); print(result); }
- Loading branch information