Want to add image preload in Flutter? Use the precacheImage function to start loading an image before your drawer is built. For example, in the widget that contains your drawer:
1 2 3 4 5 6 7 8 9 10 | class MyWidgetState extends State<MyWidget> { @override void initState() { // adjust the provider based on the image type precacheImage(new AssetImage('...')); super.initState(); } } |
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.