2

I need to change some parts 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 the 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 are there any other solutions to this problem?

Thanks in advance

MANISH
  • 2,883
  • 4
  • 11
  • 30
  • 2
    Curious... what kind of thing have you changed? Is there an issue you can reference here? Have you submitted a pull request? – Randal Schwartz Oct 09 '22 at 18:30
  • I've changed cupertino switch's thumb size from `14.0` to `12.0`, it looks much nicer for our design. I've searched for this in the github issues, saw nothing related to it. I guess they will not accept the PR because cupertino is supposedly obey the iOS design, in a strict manner (I mean, even a configurable thumb size would be against the iOS design I guess) – Özgün Özerk Oct 10 '22 at 11:17

1 Answers1

0

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?

Gregory Conrad
  • 1,324
  • 11
  • 19
  • I see, so there is no way to tell github actions to use my fork of flutter in the CD. I actually modified the thumb size of the cupertino switch. So maybe a better approach would be somehow extract the cupertino switch as a separate package, upload it to github, and have a dependency to it in the `pubspec.yaml` – Özgün Özerk Oct 10 '22 at 11:14
  • Didn't see your tidbit on CI/CD before--you can set your CI/CD to use your own custom fork of flutter. I am guessing you are using https://github.com/marketplace/actions/flutter-action. I don't see any support for custom forks on this action at first glance, but you could fork the action and then have it point to your own Flutter fork. However; you should do as you described: extract the Cupertino switch, make your changes, upload as a separate package to Github, and then reference that in your pubspec.yaml. – Gregory Conrad Oct 10 '22 at 17:01