diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt index 77417417c9..c04ef90a90 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/DataStoreHubEventStreamHandler.kt @@ -38,7 +38,7 @@ class DataStoreHubEventStreamHandler : EventChannel.StreamHandler { private var forwardHubResponse: (event: Map) -> Unit // DataStore hub event history. Used to track events which may be lost on hot restart, such as sync and ready events. - private var eventHistory: MutableList> = mutableListOf() + private var eventHistory: MutableList> = java.util.Collections.synchronizedList(mutableListOf()) // Event types which should be replayed on hot restart. private val replayEvents: Set = setOf(