Home > other >  How to use my own fork of flutter in `pubspec.yaml`
How to use my own fork of flutter in `pubspec.yaml`

Time:10-10

I need to change some part of the original flutter code in my project. I know that I can do so in my local copy. However, we are working as a group and I don't want my changes to be local.

Also, we will probably use github actions for CD. If I only change my local copy of flutter source code, the executable/app generated by the CD won't match what I'm locally building.

In short, the problem: having github CI/CD to match my local setup, and all participants in the project to share the same code-base and dependencies, with a custom fork of flutter present.

Is there any way to provide my own fork of flutter to the pubspec.yaml file? Or is there any other solutions to this problem?

Thanks in advance

CodePudding user response:

You would have to fork the flutter repo, make your changes, and then publish your fork for your teammates to access. Then they would have to git clone your fork and use that as their local flutter installation to build the project.

There is no way to do this in pubspec.yaml. You can set flutter version constraints for when you are developing packages in the pubspec.yaml, but that is not what you are trying to do here.

Perhaps it would be worth taking a look at another solution. I am not sure what you modified, but instead of modifying whatever you did directly, how about you copy all of the relevant source code into your own project (I'm guessing a widget), modify the code in your project, and then reference your own custom code instead of Flutter's version?

CodePudding user response:

dependency_overrides:
  easy_image_viewer:
    git: "https://github.com/mrasityilmaz/easy_image_viewer.git"

I guess you want to add a Flutter plugin from your Github. For this, you can add it to the end of the pubspec.yaml file like this

  • Related