To speed up the loading of profile images, I created an Isolate and cached it in it.
Code to load profile image
influencers.forEach(
(influencer) {
Isolate.spawn(
FileDownloadController.imagePreload,
influencer.profileImgUrl,
);
},
);
imagePreload in FileDownloadController
static void imagePreload(String url) {
CachedNetworkImage(imageUrl: url);
}
My intention
- When the runApp() is executed to start the app, the influencers.forEach() statement works to cache the image.
- When approaching the influencer screen, pre-cached images are used.
Is this right?
I was told that 'Isolate' cannot be involved in other 'Isolate'. Wouldn't it be futile to cache images this way?
I want to know if I understood 'Isolate' properly.