dart-pub

Dart best practices for develop and production

故事扮演 提交于 2019-12-13 15:26:12
问题 Sorry if this is a noop question, but I'm pretty new to Dart. I wonder if someone has good links or ideas for best practices for develop and debug a Dart application in a node.js environment. I can start a standalone Dart app and call a rest api using absolute url, but I think the Dart app should be served using node.js and the urls should be relative. In production we also need to serve the js compiled app. Do you know how to build a good development environment, near to production? 回答1: You

Dart: pub get vs pub upgrade

和自甴很熟 提交于 2019-12-12 09:54:35
问题 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

Dart 2.3 ignores breakpoints

China☆狼群 提交于 2019-12-11 17:25:28
问题 I am developing a web app in Dart using Webstorm as IDE. After upgrading from Dart SDK 2.2 to Dart SDK 2.3 I noticed that all breakpoints I set in Webstorm are ignored (although the app seems to run properly in Chrome) That breakpoints are correctly marked as a "red circle" but unlike the previous SDK they miss the "tick" inside (which I think means they are not recognized by Chrome). I tried to "repair cache" and "upgrade dependencies" but breakpoints still don't work. That's the pubspec

Why is dart pub suddenly trying to install packages in my css folder?

别来无恙 提交于 2019-12-11 13:59:44
问题 Running pub update ... Pub update failed, [1] Resolving dependencies... DirectoryIOException: Directory listing failed, path = <longpath>/web/css/packages (OS Error: No such file or directory, errno = 2) Why would pub suddenly try to look for packages in my css folder? 回答1: The short answer, pub puts symlinks into subdirectories to ensure that you can use package: in any Dart file in any subdirectory of a "deployable" directory. Because web is deployable in the sense that you'll likely take

Cannot add mdl packages to pub cache

烂漫一生 提交于 2019-12-11 10:33:50
问题 I cannot add the package mdl https://pub.dartlang.org/packages/mdl to pub cache using either the command pub cache add mdl or using the dependency dependencies: mdl: "^1.1.2" in my pubspec.yaml file. The author says it is a Windows issue as it works as designed on Linux and iOS. I am using the current WebStorm on Windows 8.1 x64. This is the first time I am having such an issue. Using the command line pub --trace cache add mdl I receive the following trace J:\workspace\epimss\dart\epimss_app

Pass custom parameters to a dart application when using pub serve to run it

為{幸葍}努か 提交于 2019-12-11 08:45:27
问题 Is it possible to pass some argument to a dart application when running it using pub serve ? What I'm trying to do is have an application use some mocked services while I'm developing it, but then when it's deployed I'd like to replace mocked services with real ones. For example: const bool DEBUG = true; class AppModule extends Module { AppModule() { type(PaymentService, implementedBy: DEBUG ? PaypalPaymentService : MockPaymentService ); } } I'd like this DEBUG parameter to somehow come form

Turn off dart2js during pub build

匆匆过客 提交于 2019-12-11 01:28:29
问题 I am writing a custom transformer for pub build . I would like to turn off compilation of dart files to js during debugging of the transformer to save time. Is it possible? Currently, my simplified pubspec.yaml is name: my_proj dependencies: polymer: any transformers: - my_proj 回答1: There is no option for pub build only for pub serve --no-dart2js . You could temporary modify the file dart/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart in your dart install directory and set

Does Dart have import alias?

你离开我真会死。 提交于 2019-12-10 14:27:06
问题 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 '@shared/constants.dart'; Thanks, Javi. 回答1: No. Dart do not have import alias. But you have absolute imports which makes up for it: import 'package:my_lib/shared/constants.dart This will import the file /lib/shared/constants.dart 回答2: Dart doesn't allow you to rename imported

Package import - Target of URI does not exists

浪子不回头ぞ 提交于 2019-12-08 17:00:31
问题 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 exists' Thanks for your help! 回答1: I know this is an old question, but I came across it and resolved it. But anyone that runs into this, simply close your project and reopen it. That solved it for me. I'm using Android Studio. 回答2: If you are using

How to develop a Dart library locally?

天涯浪子 提交于 2019-12-07 07:32:10
问题 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? 回答1: To use a local library, you can specify a local filepath in