Skip to content

Commit c3561dd

Browse files
authored
Update README.md
1 parent b6cc058 commit c3561dd

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

AndroidAsync-Kotlin/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,27 @@ suspend fun getTheRobotsTxt() {
1212
.await()
1313

1414
val githubRobots = Ion.with(context)
15-
.load("https://google.com/robots.txt")
15+
.load("https://github.com/robots.txt")
1616
.asString()
1717
.await()
1818

1919
return googleRobots + githubRobots
2020
```
2121

2222
That's it!
23+
24+
But remember that the await() suspends, so if you want to fetch both robots.txt at the same time:
25+
26+
```kotlin
27+
suspend fun getTheRobotsTxt() {
28+
val googleRobots = Ion.with(context)
29+
.load("https://google.com/robots.txt")
30+
.asString()
31+
32+
val githubRobots = Ion.with(context)
33+
.load("https://github.com/robots.txt")
34+
.asString()
35+
36+
return googleRobots.await() + githubRobots.await()
37+
```
38+

0 commit comments

Comments
 (0)