docs
docs copied to clipboard
Android DataStore invalid code snippets
Describe the bug Android DataStore code snippets do not compile
To Reproduce 1a. See https://docs.amplify.aws/lib/datastore/data-access/q/platform/android/#predicates
Under "Kotlin - Callbacks"
Amplify.DataStore.query(Post::class.java,
{ posts ->
while (posts.hasNext()) {
val post = allPosts.next()
Log.i("MyAmplifyApp", "Title: ${post.title}")
}
},
{ Log.e("MyAmplifyApp", "Query failed", it) }
)
It appears allPosts should be posts.
1b. Under Delete

Remove first sentence. This might require some work due to shared fragments
2a. See https://docs.amplify.aws/lib/datastore/real-time/q/platform/android/
Amplify.DataStore.observe(Post::class.java,
{ Log.i("MyAmplifyApp", "Observation began") },
{
val post = postChanged.item()
Log.i("MyAmplifyApp", "Post: $post")
},
{ Log.e("MyAmplifyApp", "Observation failed", it) },
{ Log.i("MyAmplifyApp", "Observation complete") }
)
"postChanged" should be "it" i think, here's a screenshot of the code in Android Studio

2b. Indentation on the RT page looks off
