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:

1128 questions
4
votes
1 answer

How to find path to the package directory when the script is running with `pub run` command

I am writing a package that loads additional data from the lib directory and would like to provide an easy way to load this data with something like this: const dataPath = 'mypackage/data/data.json'; initializeMyLibrary(dataPath).then((_) { //…
localvoid
  • 101
  • 5
4
votes
1 answer

Why pub upgrade don't upgrade packages and just show them

I've got: >pub upgrade Resolving dependencies... (6.2s) analyzer 0.18.0 (9 newer versions available) angular 0.14.0 args 0.10.0+2 (5 newer versions available) barback 0.13.0 (14 newer versions available) bootjack 0.6.5+2 browser…
cnd
  • 32,616
  • 62
  • 183
  • 313
4
votes
1 answer

How do I import a library from the lib folder in my web app?

My folder structure looks like this: lib\ my_library.dart web\ index.html main.dart pubspec.yaml In main.dart, I'm currently importing my_library.dart (which has library my_library at the top) by doing: import…
Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275
4
votes
1 answer

How do I install a Dart package globally?

Does Pub Package Manager provide a way to install packages globally? I have been a node.js developer for a while and I was wondering if there was a pub equivalent of npm install -g If there is a way to install packages globally, is…
codematix
  • 1,317
  • 1
  • 16
  • 30
4
votes
2 answers

Can you pass compiler flags to dart2js via Dart Editor

I want to run a no minify build but not from Terminal. Can I do it form the Dart Editor IDE itself?
robbie
  • 269
  • 1
  • 9
4
votes
1 answer

Dart without Dart-Editor: Refreshing

I'm trying to program in Dart but without the Dart-Editor. It works fine so far but its really annoying and slow to always call pub build after making a change to either html/css or dart code. As far as I remember when launching the app with…
elfeck
  • 385
  • 1
  • 8
4
votes
2 answers

Questions on using dart without dart editor

I'm trying to get dart working. As editor I want to use emacs dart-mode. I've got 2 questions concerning using dart without the dart editor: 1) Do I manually need to call dart2js or does the in html included script dart.js do that for me? Where can…
elfeck
  • 385
  • 1
  • 8
4
votes
1 answer

How to deploy a Dart Polymer app to Javascript using dart2js

I got a problem while deploying Dart code using Polymer to Javascript. I've created a polymer application with DartEditor and made a simple example. This example works in Dartium but when I try to build it as a Polymer App (in Javascript) and launch…
4
votes
2 answers

Is it possible to give a different name to a package dependency in pubspec

I managed to add a relative path dependency in my app name: myapp description: A sample app dependencies: mylib: path: ../mylib and then import it in my source code import 'package:mylib/mylib.dart'; However, the name 'mylib' is taken from…
alextk
  • 5,713
  • 21
  • 34
4
votes
2 answers

Is there a way to disable all those symlinks to the packages directory?

I am using the Dart Eclipse plugin following this guide: http://blog.dartwatch.com/2013/01/integrating-dart-into-eclipse-and-your.html ( without the Maven integration ) If I use the pubspec.yaml file, my project gets spammed with these packages…
Ray Hulha
  • 10,701
  • 5
  • 53
  • 53
4
votes
2 answers

Pub install stalls on "running pub install" dialog

I'm running pub install so I can use the intl package (I need to use the DateFormat class) that's part of the dart sdk. I've installed other packages into my project such as the XML parser and presentation (similar to impress js). I had no trouble…
kbyrd
  • 43
  • 3
4
votes
5 answers

Cannot find referenced source: packages

I have this pubspec.yaml name: Dart Pages description: The Dart platform. dependencies: web_components: any mongo_dart: any then I run Tools > Pub Install, the operation completes successfully. When I run the application I…
samer.ali
  • 396
  • 2
  • 3
  • 11
3
votes
2 answers

Execution failed for task ':app:compileFlutterBuildDebug'. > Process 'command '/Users/cit/flutter/bin/flutter'' finished with non-zero exit value 1

ANY ONE PLEASE HELP ME WITH THIS ERROR. FAILURE: Build failed with an exception. Where: Script '/Users/cit/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159 What went wrong: Execution failed for task…
3
votes
1 answer

The name 'IOSNotificationDetails' isn't a class. Try correcting the name to match an existing class

*I'm actually following the Flutter Local Notification in YouTubel and the link is : Flutter Local Notification I'm using windows laptop and android emulator and I also updated the build.gradle file. I'm getting an error at var…
Shreyas K S
  • 49
  • 1
  • 4
3
votes
2 answers

Dart Error: Dart_LookupLibrary: library 'package:home_widget/home_widget_callback_dispatcher.dart' not found

A very strange issue. I am using https://pub.dev/packages/home_widget and I am trying to use the backgroundCallback to refresh my widget by pressing an image on the widget. It works fine on debug mode, however when I build apk or run flutter run…
1210saad
  • 37
  • 5