dart-pub

How make pub build to use source maps on dart polymer projects

依然范特西╮ 提交于 2019-12-06 10:17:21
问题 On a dart polymer project when I do a debug pub build like so: pub build --mode debug the build process does correctly produce unminified javascript with source maps for the dart code. However, the generated html file still references the .dart bootstrap script. I can always manually modify the html after the fact to use the .js file, but that's a pain. How do I get pub build to automatically generate an html file that references the debug javascript? 回答1: One solution is to add a js: true

Choosing between package:html, dart:html, dart:io (class HttpClient) and package:http APIs to fetch HTTP resources

你。 提交于 2019-12-06 08:02:52
问题 I realized that currently there are at least three "official" Dart libraries that allow me to perform a HTTP request. What is more, three of those libraries (dart:io (class HttpClient), package:http and dart:html) have each a different, incompatible API. As of today, package:html does not offer this functionality, but on its GitHub page I found it aims for 100% API compatibility with dart:html, so these methods will be added there eventually. Which package provides the most future proof and

Dart: pub get vs pub upgrade

对着背影说爱祢 提交于 2019-12-06 02:19:09
According to the pub get docs the main difference between pub get and pub upgrade is: If a lockfile already exists, pub get uses the versions of dependencies locked in it if possible. If a dependency isn’t locked, pub will get the latest version of that dependency that satisfies all the version constraints. This is the primary difference between pub get and pub upgrade, which always tries to get the latest versions of all dependencies. But this leaves me with a few questions. What do they mean by " If a dependency isn't locked ... ? Locked?!? Like in version control? File system lock? What is

Is there a workaround for pub dependency resolution through proxies?

孤者浪人 提交于 2019-12-05 18:51:24
I'm trying to play with https://github.com/dart-lang/web-ui-code-lab for dart development. If I follow the pdf and open step05, then try to run chat_server.dart, I get this error (my path has no spaces in it, in case that's relevant): dart --enable-checked-mode bin/chat_server.dart Unable to open file: path/to/web-ui-code-lab-master/step05/bin/packages/dart_chat/file_logger.dart'file:///path/to/dart/web-ui-code-lab-master/step05/bin/chat_server.dart': Error: line 5 pos 1: library handler failed import 'package:dart_chat/file_logger.dart' as log; ^ I presume this means that there are some

How to develop a Dart library locally?

こ雲淡風輕ζ 提交于 2019-12-05 13:03:46
I might be having a mental eclipse, but it's hard for me to do the simplest thing: write a simple library and use it . (I want to do this all locally, without publishing the library, etc.) I've browsed through the list of pub commands and none seems to install a package locally, so how can I use it in other projects? For example, I just cloned this library and would like to test it locally to see if it works. How can I do that? To use a local library, you can specify a local filepath in your pubspec, such as: dependencies: transmogrify: path: /Users/me/transmogrify When using a local

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

纵然是瞬间 提交于 2019-12-05 09:34:07
问题 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 mean? Notes I looked in the yaml documentation but I didn't see anything that made sense. Related: what does Caret sign do in Dart (but it isn't an XOR operator here) Related: In Flutter, Dependencies must specify version number? (an answer pointed me in

Choosing between package:html, dart:html, dart:io (class HttpClient) and package:http APIs to fetch HTTP resources

拟墨画扇 提交于 2019-12-04 12:19:36
I realized that currently there are at least three "official" Dart libraries that allow me to perform a HTTP request. What is more, three of those libraries (dart:io (class HttpClient), package:http and dart:html) have each a different, incompatible API. As of today, package:html does not offer this functionality, but on its GitHub page I found it aims for 100% API compatibility with dart:html, so these methods will be added there eventually. Which package provides the most future proof and platform independent API to issue a HTTP request in Dart? Is it package:http? import 'package:http/http

How to deploy a Dart Polymer app to Javascript using dart2js

こ雲淡風輕ζ 提交于 2019-12-04 10:20:31
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 it, the app fails. How am I supposed to convert a Dart Polymer app to Javascript ? Here's the example code I made that fails : example.html : <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Example</title> <link rel="import" href="example-polymer.html"> <script type="application/dart">export 'package:polymer/init.dart';</script> <script

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

五迷三道 提交于 2019-12-04 02:56:52
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? You can set the environment variable PUB_HOSTED_URL so it points to your custom pub repo server. This way pub loads all packages which don't have a server specified from this server. You can define exceptions in pubspec.yaml like dependencies: transmogrify: hosted: name: transmogrify url: http://some-package-server.com see https://www.dartlang.org/tools/pub/dependencies.html for more details. There is another package

webcomponents.js fails with error 404

旧街凉风 提交于 2019-12-02 05:20:32
问题 I'm seeing exceptions in my console when running my dart app related to webcomponents.js Everything is running as expected, should I ignore this exception? Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/packages/web_components/webcomponents.js pubspec.yaml: name: alm description: alm dependencies: browser: any # bootjack: any polymer: ">0.15.3" paper_elements: any transformers: - polymer: entry_points: - web/index.html index.html <!DOCTYPE