I am facing a problem of whenever a user signs out FirebaseAuth.instance.signOut() and signs In with another account the previous user's data is visible. I have seen documentation and got an idea of clearing the cache data using FirebaseFirestore.clearPersistence(). I tried this in the signOut method but though previous user's data is still visible. Can anyone please solve my issue!
main.dart
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
FirebaseFirestore.instance.settings=Settings(
persistenceEnabled: false,
);
runApp(MyApp());
}
firebaseAuth.dart
static logOut()async{
await FirebaseFirestore.instance.clearPersistence();
return FirebaseAuth.instance.signOut();
}
THANK YOU SO MUCH!