Skip to content

Cache the SDK on switching channel #64822

Closed

Description

@aromalanil

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

Activity

  1. sidrao2006 commented on Aug 29, 2020

    @sidrao2006
    Contributor

    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

  2. aromalanil commented on Aug 29, 2020

    @aromalanil
    Author

    @sidrao2006

    Dart SDK takes up a lot of space.

    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.

    flutter channel beta --enable-cache

    To cache the current SDK, and when switching channel back

    flutter channel stable --use-cache

    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.

  3. sidrao2006 commented on Aug 29, 2020

    @sidrao2006
    Contributor

    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.

  4. added
    c: proposalA detailed proposal for a change to Flutter
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Aug 31, 2020
  5. jmagman commented on Sep 1, 2020

    @jmagman
    Member

    Duplicate of #44212

  6. github-actions commented on Aug 13, 2021

    @github-actions

    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 -v and a minimal reproduction of the issue.

  7. locked as resolved and limited conversation to collaborators on Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: proposalA detailed proposal for a change to FluttertoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions