Cache the SDK on switching channel #64822
Copy link
Copy link
Closed
Labels
c: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to FluttertoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Description
Use case
A new SDK is downloaded each time the user switches channel.
- This is time consuming.
- This is bad User Experience.
Proposal
What if the SDK which is present in the user's device is cached before switching the branch. If the caching is done before user switches to another channel, when he switches back the old SDK will be present on the device and hence we can avoid redownloading it.
- This will be much faster
- It will save user some data.
Example
Consider if I am using stable SDK, and I switched to beta channel to enabling web support. So if I don't want to do web anymore I will switch back to the stable version, and for this SDK is to be redownloaded.
If the previous SDK was cached before I switched the channel, this redownloading can be avoided
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
c: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to FluttertoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Activity
sidrao2006 commentedon Aug 29, 2020
Hey @aromalanil , looks good but the Dart Sdk takes up a lot of space and flutter will have to build again while switching channels as the FLUTTER_ROOT variable has only one flutter path
aromalanil commentedon Aug 29, 2020
@sidrao2006
This is exactly why I am suggesting this. Every time a user changes the channel this large SDK is to be downloaded.
So why don't we cache the current SDK when switching to another. If this will turn into a problem for users with low storage space, my suggestion is to make this caching an opt-in feature.
If a user wants to try out the beta and he is sure that he will come back to stable, then he may turn on this caching option when switching to another channel.
I don't know if this is stupid, but what I am proposing is something like this.
To cache the current SDK, and when switching channel back
And after this when the user runs
flutter upgrade, flutter should look if the latest version of the SDK is available in the cache, and if it is available it should be used instead of downloading it again.I am not saying we should avoid the rebuild, but should prevent redownloading the SDK if possible.
sidrao2006 commentedon Aug 29, 2020
You are right but if you have noticed the steps, it builds the flutter tool every time. So the tool has to be configured to look for a cache when switching back and then add it to path as there can be only one dart sdk in the PATH. Also flutter will have to build the tool and download all the other development tools.
jmagman commentedon Sep 1, 2020
Duplicate of #44212
github-actions commentedon Aug 13, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.