Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Pubspec.yaml Warning: Publishable packages can't have git dependencies

Tags:

git

flutter

I'm using Sembast Cloud Firestore type adapters in my pubspec.yaml:

  sembast_cloud_firestore_type_adapters:
    git:
      url: git://github.com/tekartik/sembast_flutter_more.dart
      path: cloud_firestore_type_adapters
      ref: dart2
      version: '>=0.1.0'

and loading adapters:

  loading:
    git:
      url: git://github.com/leonzone/loading.git
      path: loading
      ref: 8f5a63f

Everything works fine until today. I got this error for both of the above lines: warning: Publishable packages can't have git dependencies.

Here is my flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.24.0-7.0.pre.71, on Mac OS X 10.15.7 19H2 darwin-x64,
    locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.50.1)
[✓] Connected device (3 available)

• No issues found!
like image 363
Zenko Avatar asked Nov 03 '20 09:11

Zenko


People also ask

How do you add dependency in Pubspec Yaml in flutter?

You can go to the pubspec. yaml file and add dependencies ,under dependencies and then packages get will do the work. or you can run flutter pub get in the terminal.

Where is Pubspec Yaml in flutter?

yaml file, often referred to as the pubspec. A basic pubspec is generated when you create a new Flutter project. It's located at the top of the project tree and contains metadata about the project that the Dart and Flutter tooling needs to know.

Where does flutter install dependencies?

If you are running Windows as your OS, you can find the packages under the folder that you installed your Flutter SDK to when setting up Android Studio. In my case - using Windows 10 - the path is as follows, where C:\ is my primary harddrive and flutter\ the folder containing the Flutter SDK...

Why are my flutter packages not working with Git repositories?

Just having a Git repository dependency seems to cause flutter packages get to not work correctly. It seems like the advice given here is completely busted when trying to use Git repositories. Sorry, something went wrong. Do you actually have a name: foo in your pubspec.yaml like the error message demands?

Can publishable packages have git dependencies?

Bookmark this question. Show activity on this post. Everything works fine until today. I got this error for both of the above lines: warning: Publishable packages can't have git dependencies.

Why can’t I upload a package to my pubspec?

Because of this, you cannot upload a package to the pub.dev site if it has any path dependencies in its pubspec. Edit your pubspec locally to use a path dependency. Work on the main package and the package it depends on.

What is a package dependency in pubspec?

Package dependencies. Dependencies are one of the core concepts of the pub package manager. A dependency is another package that your package needs in order to work. Dependencies are specified in your pubspec. You only list immediate dependencies—the software that your package uses directly.


1 Answers

My guess is that it helps you preventing publishing dummy/old package by doing extra check on package that are set to be published. You should add (at the root of the document, for example after the version field):

publish_to: none

to your pubspec.yaml

like image 180
alextk Avatar answered Sep 28 '22 02:09

alextk