doc: update docs/dart.md (#814)

### 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);
} f0da2a3397
This commit is contained in:
jaywcjlove
2024-08-15 01:10:54 +00:00
parent 4ee2e1bc0c
commit 6a18428838
5 changed files with 97 additions and 94 deletions

File diff suppressed because one or more lines are too long