Closed jamontesg closed 2 weeks ago
Hi @jamontesg, thank you for opening this issue. Quickly looking at your repro steps, have you tried stopping DataStore when the user logs out, and Starting it back up when logged in?
For example: User logs out > Amplify.DataStore.stop();
> User Logs in > Amplify.DataStore.start();
Hi @Equartey
This is my logout. function
Future<void> logOut() async {
try {
await Amplify.DataStore.clear().then((s) {
developer.log("DataStore is cleared.");
signOutCurrentUser();
});
} on DataStoreException catch (e) {
developer.log("Failed to clear DataStore: $e");
}
}
try with this version with stop:
Future<void> logOut() async {
try {
await Amplify.DataStore.stop()
.then((s) async {
developer.log("DataStore is Stoped.");
await Amplify.DataStore.clear().then((s) {
developer.log("DataStore is cleared.");
signOutCurrentUser();
});
});
} on DataStoreException catch (e) {
developer.log("Failed to clear DataStore: $e");
}
}
don't generate this error.
@jamontesg The second snippet looks correct. To be clear, your are no longer seeing the error, correct?
As for why this fixes the error? When calling .clear() on Android, .stop() gets called for you. iOS does not do that, which is why you should call .stop() before .clear() when restarting DataStore.
yes this solve the error. maybe We need a equal behavior for iOS/Android or a more detailed documentation. Thanks fir your time @Equartey
@jamontesg glad to hear its resolved. We'll look adjusting the documentation, thanks for the suggestion. For now I'm going to close this issue as resolved.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
Description
I have an application con 18 tables , When you logout and login, you get the following error---->
flutter: ERROR | WebSocketBloc - fb75ea94-3f65-45d9-b762-0e4fed1ae8aa | Shutting down with exception: NetworkException { "message": "Exception from WebSocketService.", "underlyingException": "type '_Map<String, dynamic>' is not a subtype of type 'List?' in type cast" }
Categories
Steps to Reproduce
configure DynamoDB/ API /. AUTH with cognito group access. do a login do a logout do a login
Screenshots
No response
Platforms
Flutter Version
3.24.1
Amplify Flutter Version
2.4.0
Deployment Method
Amplify Gen 2
Schema