回答編集履歴
1
説明の追加
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
コメントでsuspendとあったので、coroutinesを使った実装例です。
|
2
2
|
|
3
|
-
[org.jetbrains.kotlinx:kotlinx-coroutines-play-services](https://github.com/Kotlin/kotlinx.coroutines/tree/master/integration/kotlinx-coroutines-play-services) を利用しています。
|
3
|
+
[org.jetbrains.kotlinx:kotlinx-coroutines-play-services](https://github.com/Kotlin/kotlinx.coroutines/tree/master/integration/kotlinx-coroutines-play-services) のawaitを利用しています。
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
.get()
|
14
14
|
|
15
|
-
.await()
|
15
|
+
.await() // データが取得されるまで待機
|
16
16
|
|
17
17
|
.takeIf { it.exists() } // existsがfalseならnullを返す
|
18
18
|
|