jaywcjlove
6a18428838
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
2024-08-15 01:10:54 +00:00
..
2024-06-08 17:44:23 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-24 21:25:17 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-21 10:12:34 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-08-15 01:10:54 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-25 15:04:47 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-07-15 10:16:47 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-07-18 09:15:17 +00:00
2024-07-28 19:22:36 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-07-17 14:46:32 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-25 15:23:27 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-07-05 04:03:53 +00:00
2024-06-06 13:52:02 +00:00
2024-07-28 15:35:27 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-07-27 15:23:06 +00:00
2024-06-06 13:52:02 +00:00
2024-06-08 17:43:35 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-24 19:32:04 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-24 21:47:37 +00:00
2024-06-06 13:52:02 +00:00
2024-06-24 19:32:04 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-25 15:23:27 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-25 15:23:27 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-25 15:23:27 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-20 10:22:45 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-26 04:13:34 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 14:22:09 +00:00
2024-08-09 03:37:18 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-07-08 17:18:48 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00
2024-06-06 13:52:02 +00:00