Questions tagged [dart-pub]

Pub is a package manager for Dart applications and libraries.

Pub is a package manager for Dart applications and libraries. You can find packages to use in a project or publish packages to the package repository. Pub automatically keeps track of dependencies to other packages and makes sure that the dependencies use the right version of a package.

Basics:

  • Use pub get to get dependencies
  • Use pub upgrade to upgrade a dependency
  • Use pub publish to make your library available for others

Resources:

786 questions
78
votes
12 answers

Flutter Pub: Expected a key while parsing a block mapping. path:

I'm using JSON file and register in Pubspec.ymal but showing error and also when I use an image and register it, the same error also occurs. Maybe there is a formatting mistake in it, but don't know what the problem is.this is the doc I…
Farhana Naaz Ansari
  • 8,382
  • 15
  • 63
  • 97
58
votes
3 answers

What is the caret sign (^) before the dependency version number in Flutter's pubspec.yaml?

In the pubspec.yaml file of my Flutter project there is a caret (^) before the version number of some of the dependencies. dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.2 english_words: ^3.1.5 What is its purpose? What does it…
Suragch
  • 364,799
  • 232
  • 1,155
  • 1,198
34
votes
1 answer

In Dart and Pub, should I add pubspec.lock to my .gitignore?

Should I add this generated file to my .gitignore so that it doesn't show up in my repository? Should pubspec.lock be included in my repository?
Juniper Belmont
  • 2,298
  • 13
  • 26
26
votes
6 answers

Could not find a file named "pubspec.yaml" in

I create a simple Web application but when I want to run it I got this message in "Tools Output": Could not find a file named"pubspec.yaml"in"/home/reza/.pubcache/hosted/pub.dartlang.org/browser-0.10.0+2". How can I fix this problem? I use Ubuntu…
Reza
  • 380
  • 1
  • 4
  • 10
23
votes
5 answers

How to install pub (command line usage) for Dart on Ubuntu web-server

I've followed the instructions here (under the Linux tab) on installing Dart onto a Ubuntu web-server. Dart itself works fine, but I can't use Pub commands (only Dart commands). How can I install Pub for the server?
Will Squire
  • 4,504
  • 2
  • 29
  • 45
22
votes
10 answers

FlutterFirebaseCorePlugin.java uses or overrides a deprecated API

Ok so I run my program without importing firebase core, firebase auth and cloud firestore, and my code runs just fine but I register my app with firebase and it still runs fine but as soon as I import Firebase_auth, Firebase_core and…
Fred_Wolfe
  • 245
  • 1
  • 2
  • 10
22
votes
3 answers

What's the difference between pub dependencies and dev_dependencies?

What is the difference in dependencies and dev_dependencies in a pubspec.yaml? It seems that when I run pub get the dev_dependencies aren't downloaded.
Austin Cummings
  • 502
  • 6
  • 15
19
votes
9 answers

Package import - Target of URI does not exists

Please check my project: https://github.com/MaximGo/WebTech_Projekt.git In the file 'tetrisclient.dart' I want to import the generated package from the lib-folder. import 'package:tetris/tetris.dart'; But I get the Erro 'Target of URI does not…
PeterP
  • 201
  • 1
  • 2
  • 3
16
votes
5 answers

How to automatically upgrade Flutter dependencies

My Flutter project has a dependency flutter_dotenv at version ^2.0.1 and I want to automatically upgrade to the new version ^2.0.2. I am running the following command to upgrade it: flutter pub upgrade Reference: Upgrading packages only To update…
Evandro Pomatti
  • 7,960
  • 11
  • 56
  • 111
15
votes
4 answers

How do I add an Example Project to a Flutter Package?

Is there a way to autogenerate template code for the example map structure in a package? Most packages have a /example folder within the package root that showcases the package functionality. I'm not sure what's the "best" way to create the…
Joel Broström
  • 2,204
  • 18
  • 36
14
votes
2 answers

What does plus one (+1) mean in dart's dependency versioning

I see this +1 in a some flutter dependencies and have been wondering what it means because i have been seeing it more often these days. Sample pubspec.yaml dependencies: flutter: sdk: flutter cloud_firestore: ^0.8.1+1 sqflite: 0.12.2+1 …
nonybrighto
  • 5,736
  • 2
  • 28
  • 44
13
votes
2 answers

Does Dart have import alias?

I found myself written tedious code when importing files into dart files like the following: import '../../constants.dart'; I'm wondering if there is any way to create an alias to specific folder like: import…
12
votes
3 answers

I migrated to null safety and i cant run "flutter pub run build_runner build" without an error being thrown

I have added // @dart=2.9 to all my files but the build_runner won't do its thing without throwing this error: Warning: Operand of null-aware operation '?.' has type 'SendPort' which excludes null. - 'SendPort' is from 'dart:isolate'. …
nnamdi
  • 121
  • 6
11
votes
5 answers

Python and Dart Integration in Flutter Mobile Application

Can i do these two things: Is there any library in dart for Sentiment Analysis? Can I use Python (for Sentiment Analysis) in dart? My main motive for these questions is that I'm working on an application in a flutter and I use sentiment analysis…
Hamza Tanveer
  • 167
  • 1
  • 1
  • 7
11
votes
1 answer

How do I run a private pub server while still referencing packages from pub.dartlang.org?

Assuming that I'm running my own instance of pub-dartlang for a private pub feed; how do I indicate in pubspec.yaml which packages come from the private feed vs pub.dartlang.org?
Danny Tuppeny
  • 32,892
  • 19
  • 124
  • 246
1
2 3
52 53