How to use a fork of flutter.widgets in a flutter project?

Viewed 981

Found this article, that seems like it would give sufficient instructions for using forked versions of many pub packages.

However, the package I want to fork (scrollable_positioned_list) is a part of a the flutter.widgets repository, which is not a package itself, but a collection of packages.

I've been able to fork and modify the package, my trouble is being able to use my fork in my project.

I've tried the obvious:

dependencies:
  flutter:
    sdk: flutter
  scrollable_positioned_list: 
    git: 
      url: https://github.com/bendelonlee/flutter.widgets

This causes flutter pub get to fail with the error:

pub get failed (1; Could not find a file named "pubspec.yaml" in https://github.com/bendelonlee/flutter.widgets 1f2935687390a9315c3336007a4eac00563365a4.)

Indeed, there is no pubspec.yaml in the root of that directory, though there is one nested in the package.

I've also tried using the url of the package inside the repository

scrollable_positioned_list: 
    git: 
      url: https://github.com/bendelonlee/flutter.widgets/tree/master/packages/scrollable_positioned_list

This fails with an error complaining that the repository isn't found:

fatal: repository 'https://github.com/bendelonlee/flutter.widgets/tree/master/packages/scrollable_positioned_list/' not found
1 Answers

The path argument should be added just as the official docs state:

Pub assumes that the package is in the root of the Git repository. To specify a different location in the repo, use the path argumen

In your specific cace this would be

  scrollable_positioned_list:
    git:
      url: https://github.com/bendelonlee/flutter.widgets
      path: packages/scrollable_positioned_list


Related