Flutter Firebase Database persistence not working. Don’t use FirebaseInstance to toggle persistent storage. Use FirebaseDatabase object to hold the instance and then set it to enable.
database = FirebaseDatabase.instance;
database.setPersistenceCacheSizeBytes(10000000); // 10MB cache is enough
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.