If they are both polymer apps on the exact same version and all their packages are the exact same version then you might be ok, but I wouldn't suggest it. Instead, can you make a single package which has two entry points (one for each of your apps)? If you...
dart2js is usually not the straight-forward way to generated JS from Dart. Normally you just run pub build in your project directory. Ensure you have your pubspec.yaml configured properly csp: true (for Chrome apps Using Polymer in a Dart Chrome App, Chrome App CSP violation after Dart/Polymer transform/compile to JavaScript)
I'm pretty sure your pub-cache is corrupted. Try to run pub cache repair from the command line.
dart,internet-explorer-10,internet-explorer-11,dart2js
I guess the click handler registration is not supported on <option> in the browsers you mention. Alternatively you can register your callback on the SelectElement.onChange and retrieve the selected with something like : import 'dart:html'; void main() { SelectElement select = querySelector('select'); select.onChange.listen((_) { final opt = select.options[select.selectedIndex]; print(opt.value); });...
Never heard of a Dart plugin for NetBeans but it seems there was an attempt - https://plus.google.com/+netbeans/posts/6pxRJwpZ3rJ - https://www.java.net/story/geertjan-wielenga-dart-and-netbeans-ide-74 - https://blogs.oracle.com/geertjan/entry/dart_and_netbeans_ide_7
You need to add a return here return _addTagToPost(conn, tag_values); and Future _addTagToPost(Connection conn, Map values) { print('trying to add tag to attached tags'); return conn.execute( "insert into atatched_tags values(currval('posts_post_id_seq'), @tag)", values) .catchError((err){ print('Execute error in addTagToPost: $err'); }); } to keep the async operations connected. Otherwise the connection is...
templates,dom,dart,polymer,dart-polymer
You could use a mutation observer on your shadow root to do this, add something like the following in your ready method: new MutationObserver((changes, _) { print(changes.any((record) => record.addedNodes.any( (node) => node is Element && node.id == 'page'))); })..observe(this.shadowRoot, childList: true); This will print true any time the page is...
dart,google-chrome-app,content-security-policy
This is the solution I have adopted in the end: var imgRequest = new HttpRequest(); imgRequest.open('GET', url); imgRequest.responseType = 'blob'; imgRequest.onReadyStateChange.listen((var request){ if (imgRequest.readyState == HttpRequest.DONE && imgRequest.status == 200) { FileReader reader = new FileReader(); reader.onLoad.listen((fe) { button.src = reader.result; }); reader.readAsDataUrl(imgRequest.response); } }); imgRequest.send(); ...
You need to add each HTML to the initialize transformer configuration entry_page list, which references a Dart by a script tag where you want initialize to take effect. Each HTML page with a Dart script tag is a self-sufficient Dart application. ...
These symlinks are necessary for many tools. You can use the experimental command line option --no-package-symlinks for pub get/pub upgrade to disable symlink creation. I tried this a while ago but the DartEditor debugger stopped working (see http://dartbug.com/21749). There are plans to get rid of symlinks entirely. A proposal exists...
If you CSS is not inside a Polymer element you need to add the polyfill version of the selectors to make it work on browsers without native shadow-DOM support html paper-dialog, html /deep/ paper-dialog { margin-top: -150px; margin-left: -300px; } html paper-dialog core-animated-pages, html /deep/ paper-dialog /deep/ core-animated-pages{ height: 300px;...
javascript,webview,dart,google-chrome-app
A webview cannot show those by default. You need to catch the dialog event, show your own UI for it (remember, Apps can't use alert and friends, so a <dialog> is a good option) and then pass the response back with DialogController...
c,memory,dart,dart-native-extension
Maybe problem in that the in first case you allocate an array on the stack? If you will use a reference to this array outside of the function (after when a function returns) you will always get a segmentation fault. Please give a small example of the use of your...
This example uses a custom compare function which makes sort() sort the keys by value. Then the keys and values are inserted into a LinkedHashMap because this kind of map guarantees to preserve the order. Basically the same as http://stackoverflow.com/a/29629447/217408 but customized to your use case. import 'dart:collection'; void main()...
html,css,dart,dart-polymer,paper-elements
The only way I was able to get around this issue was with this: paper-input-decorator[focused] /deep/ .floating-label, paper-input-decorator[focused] /deep/ .label-text { /* floating label color when the input is focused */ color: orange !important; } Notice how it was necessary to type paper-input-decorator[focused] /deep/ twice...
It happens because JwtSessionHandler expects lookupByUsername function with only one parameter, not lookupByUsernamePassword which has two.
You can use as to "cast" in Dart. import 'dart:html'; ... if((querySelector('#username') as InputElement).value!="") ...
You can use pub build --output=someOtherDir See also pub help build
dart,dart-polymer,paper-elements
update I think this is the easiest way void onCoreSelectCountryHandler(dom.CustomEvent e, var detail) { print(countries[$['country'].selected].name); // or if you really need to access the `<paper-item>` element print(detail['item'].text); } old There is no selected in paper-dropdown. Wrap a core-menu within the paper-dropdown which provides selected. see - https://www.polymer-project.org/0.5/docs/elements/core-menu.html and the example...
syntax,dart,syntax-error,questionmark
The feature existed at some point in Dart's development, but it was removed again because it caused more complication than it removed, without solving the problem that actually needed solving - forwarding of default parameters. If you have a function foo([x = 42]) and you want a function to...
I was missing symlink. After adding symlink tests are working. ln -s /path/to/chrome /path/to/dartium where /path/to/chrome is your chrome executable from dartium directory...
This should work import 'dart:js' as js; ... void someCallback(e) { print('callback called, passed: $e'); } ... js.context.callMethod(r'$', ['#myModal']) .callMethod('on', ['hidden.bs.modal', someCallBack]); or ... js.context.callMethod(r'$', ['#myModal']) .callMethod('on', ['hidden.bs.modal', (e) { print('callback called, passed: $e'); }]); ...
The method getAllResponseHeaders() is unstable so you shouldn't rely on it/shouldn't be using it. If you need a Map format you can use the responseHeaders getter from HttpRequest....
The http package also contains a client that runs in the browser. Just change the import to import the file package:http/browser_client.dart; instead.
javascript,dart,operator-overloading,operators,overloading
Operators are just syntactic sugar for method calls and there is nothing special to consider for dart2js.
The easiest way is to use the "new" async/await main() async { int total = 0; print("Please input an URL"); var url = stdin.readLineSync(); var list = await getImageUrls('url'); for(int i = 0; i < list.length; i++) { var imageUrl = list[i]; var r = await getImageSize(imageUrl); print("$imageUrl, Size: $r...
This is a bug in the RPC package. I will fix this ASAP and publish a new version of the RPC package. You are welcome to file this kind of issue under github at: https://github.com/dart-lang/rpc/issues Cheers, /gustav...
Use an async function instead. import "dart:async"; String _someData = ""; Future<String> getSomeData() async { if (_someData == "") { _someData = await Api.getSomeData(); } return _someData; } Compiler generates approximately the following code: import "dart:async"; String _someData = ""; Future<String> getSomeData() { var $_awaiter = new Completer<String>(); try {...
javascript,html,css,browser,dart
I would say that you can't. Both getComputedStyle(yourElement, '::selection').backgroundColor and getComputedStyle(yourElement, '::-moz-selection').backgroundColor will return transparent as default value and browser won't override os's default. (Worth to be mentioned that if you set it to transparent, default os' value will be overriden). I don't think browsers have access to os default...
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 dependency, Dart will pick up any changes automatically, so there's no need to run a special pub command....
dart,dart-js-interop,resumablejs
You have to use JsObject.fromBrowserObject to get the underlying js object. files.forEach((file) { rs.callMethod("addFile",[new JsObject.fromBrowserObject(file)]); }); ...
Use an HTML/CSS-only loading indicator and style it so that it becomes hidden when the unresolved attribute is removed from the body. See https://www.polymer-project.org/0.5/articles/styling-elements.html#preventing-fouc
I got it working with this client code import "dart:html"; void main() { Map _queryParameters = {"username": "fred", "password": "blah"}; var _button = querySelector("#login_button"); _button.onClick.listen((MouseEvent e) async { e.preventDefault(); var requisition = new HttpRequest(); Uri uri = new Uri( path: "http://localhost:8080/login/"); requisition.onLoadEnd.listen((_) { print(requisition.response.toString()); }); HttpRequest request = await HttpRequest.postFormData(...
Something like: class LoginResult { bool success = false; String username; } Stream<LoginResult> onLogin() async* { while(...) { yield new LoginResult() ..success = isSuccess ..userName = 'someUser'; } } or StreamController<LoginResult> onLoginController = new StreamController<LoginResult>(); // might not be necessary if you only need one listener at most Stream<LoginResult> _onLogin...
This should be fixed in the latest version of the Dart RPC package (v0.4.3). Please try it out and let me know how it works. /gustav...
eclipse,playframework-2.0,dart,dart-pub,typesafe-activator
I guess the best way is to use a proxy with rules to forward requests for Dart resources to pub serve and play resources to activator. This would be simple to build in Dart for example using shelf, shelf_route and shelf_proxy or nginx with a few forwarding rules.
security,authentication,websocket,dart,dart-html
You will have to use cookies which are automatically sent by websocket as well but you can't customize the headers sent with a WebSocket request. You can also send receive and send a session token in the payload. See https://devcenter.heroku.com/articles/websocket-security#authentication-authorization for more detailed explanation....
Solution: Create an object in JavaScript such as this: var FunctionObject = function() { this.fun = function (name) { var text = "var funs = " + document.getElementById("personalFun").value; eval(text); return funs(name); }; }; Then create the object in Dart: caller = new JsObject(context['FunctionObject'], []); Finally call the method to dynamically...
These editors are only examples to demonstrate how you can build your custom editors. I'll create an issue and fix it anyway. Thanks for reporting. https://github.com/bwu-dart/bwu_datagrid/issues/115
I have the following workaround in the meantime. It is an ugly workaround that gets me the directory name of the current test script if I'm running it directly or with pub run test. It will definitely break if anything in the implementation changes but I needed this desperately... library...
You URL in the action attribute is relative that means it is appended to the current hostname. Thus change it to a absolute URL by adding http:// to it or changing it to /login if you're already on localhost:8080.
dart,google-chrome-app,chromium,chrome-gcm
Ok... The version Dartium used in DartEditor is 39.0.2171.0 To use chrome.gcm.register (senderIds) without user logged must have at least version 40. You have to import the package in an updated version of chrome. I hope it can help someone otherwise I can delete....
dart,dart-polymer,paper-elements
I don't know why querySelector doesn't work but selected expects an index by default not an element. if you specify the valueattr attribute you can use other attributes than the index. <paper-tabs id="inner_tabview" noink="true" valueattr="data-id"> <template repeat="{{item in tabNames}}"> <paper-tab data-id="{{item['id']}}"><h3>{{item['name']}}</h3></paper-tab> </template> </paper-tabs> then tabView.selected = itemId; should work as...
In Polymer you only have ` <template if="{{selection == 'settings'}}">....</template> <template if="{{selection == 'home'}}">....</template> <template if="{{!(selection == 'settings' && selection == 'home')}}">....</template> which is obviously not as terse as ng-switch. In Polymer 0.8 <template if...> and <template repeat...> are built as a custom element. The same can be done for...
You should be able to work around like import 'dart:js' as js; ... new js.JsObject.fromBrowserObject($['dialog']) .callMethod('notifyResize', []); or import 'package:paper_elements/paper_dialog.dart'; ... ($['dialog'] as PaperDialog).jsElement .callMethod('notifyResize', []); Please create a bug report in the github.com/dart-lang/paper-elements repo (or core-elements, because I think this function should be inherited from core-overlay)...
By prefixing the Date in front of the time, DateTime would be able to parse the given String. DateTime parse(String timeValue) { var prefix = '0000-01-01T'; return DateTime.parse(prefix + timeValue); } If you also only want to display the time afterwards, format your DateTime variable accordingly: String format(DateTime value) {...
boo() is only executed when foo() returns true, because the result would be false anyway (short-circuit). You have to force explicit execution like: var f = foo(); var b = boo(); (f || b) ? print('false') : print('true'); If you want to use it inline you can use a custom...
You can find the error codes for postgresql here. Error 42601 means a syntax error. I suspect the cause is that you are missing a closing bracket on the 'values' clause, after @flag....
At first, ensure you build in release mode. (default if you run pub build from command line. I haven't checked for a while but I assume there is still this Dart script tag which was introduced when it was still planned to integrate Dart into Chrome. This will hopefully fixed...
You can just create a new child process with your_executable or alternatively with runInShell, create a new child process with the shell executable and pass -c your_executable to make the shell create a new child process with your_executable. For example if you want to execute bash builtins or if you...
Use the shared: true argument of HttpServer.bind Example: import 'dart:io'; import 'dart:isolate'; import 'package:shelf/shelf.dart' as shelf; import 'package:shelf/shelf_io.dart' as shelf_io; import 'package:args/args.dart' show ArgParser; main(List<String> args) { var parser = new ArgParser() ..addOption('address', abbr: 'a', defaultsTo: '0.0.0.0') ..addOption('port', abbr: 'p', defaultsTo: '9393') ..addOption('isolates', abbr: 'i', defaultsTo: '3'); var arguments =...
Here is an example of a transformer that use the analyzer package to find the classes that extends DynamicallyAccessible and inject the code for the operator[]. import 'package:barback/barback.dart'; import 'package:analyzer/analyzer.dart'; class DynamicallyAccessibleTransformer extends Transformer { DynamicallyAccessibleTransformer.asPlugin(); get allowedExtensions => '.dart'; apply(Transform transform) async { var content = await transform.readInputAsString(transform.primaryInput.id); var...
inheritance,dart,dart-editor,abstract-methods
From your question I would expect code like this void main() { new B(); } abstract class A { A() { a(); b(); c(); } a(); b(); c(); } class B extends A { B() : super(); @override a() => print('a'); @override b() => print('b'); @override c() => print('c'); }...
The way core-signal works, the data key of your detail object is what actually gets set as the detail of the event. The name property is then used to build the event type (it will be core-signal-$name). See the docs here https://github.com/Polymer/core-signals/blob/master/core-signals.html#L79...
If you want to know how to start it from DartEditor, just right-click the file in the Files view and choose Run. If you click the Run button in the toolbar, probably the previously launched file is launched (didn't use DartEditor since 1/2 year) If you want to launch it...
Implement noSuchMethod(); When a class has a noSuchMethod() it implements any method. I assume this applies to getter/setter as well because they are just special methods (never tried myself yet though). See also https://www.dartlang.org/articles/emulating-functions/#interactions-with-mirrors-and-nosuchmethod
json,symfony2,dart,fosrestbundle
Problem You usually have a list of objects. You sometimes get an object with sub-objects as properties. Underlying issue JS/JSON-Lists are ordered from 0 upwards which means that if you have PHP-Array which does not respect this rule json_encode will output a JS/JSON-Object instead using the numeric indices as keys....
Ensure that you always return the future when you call async functions within async functions to keep them connected. When you call an async function like .then((x) => someAsync()) the future returned from someAsync() is automatically returned but when your code has a block body like .then((x) { return someAsync()...
In the receiver window, when you receive the message, you get the sender passed with the message and you can send back to this sender. window.onMessage.listen((e) { e.source.postMessage({'somedata': 'xxx'}, '*'); }); ...
You cannot extend the String class like you want. Just use it like this: capitalize("WORLD"); ...
webview,dialog,dart,google-chrome-app
The problem definitely lies with your usage of Dart's Event class. It simply does not support the extra properties that Chrome is adding to the event: e.dialog, e.messageText, e.messageType. It does not seem like there is a ready solution for that, at least not in chrome.dart. Sadly, I don't know...
If you use pushState (default) you need server support to redirect a request to the correct URL. This is often delegated to nginx for example. Alternatively you can disable pushState and use fragments instead var router = new Router(useFragment: true) ..addHandler(new UrlPattern(r'(.*)#something'), (_) => view = 'home') ...
I figured it out. I tried to access resources from a different domain (localhost:8080 and not localhost:8080/newest). This requres setting CORS header in the shelf.response. This is done for example like that shelf.Response.ok('Message returned by handleNewest later fetched by db', headers: CORSHeader); where CORSHeader is set to const Map<String, String>...
Textarea doesn't have a value attribute. Try this instead <textarea>{{results['comments']}}</textarea> For more information about the message Removing disallowed attribute see How to create shadow DOM programmatically in Dart?...
javascript,dart,dart-js-interop
It works with js["appendChild"].apply([span], thisArg: js); If you don't provide thisArg it's like you call Function.prototype.apply with null as first argument. Thus your Dart call is the same as the js : var div = document.querySelector('div'); var span = document.createElement("span"); span.innerText = "hello world"; div["appendChild"].apply(null, [span]); The execution of above...
javascript,integer,dart,precision
Yes, this is because JS doesn't have 64 int. I'm not sure what you mean by the rest of your question. If you store bigger values as double, you loose precision.
No, this is perfectly fine. When it's observable or published it's still a normal field of the class but is wrapped to fire events when the value changes.
This can't be done. Dart is single-threaded. If you stop execution the code updating the field can't be executed. If you want something like that you need to switch to async execution. import 'dart:async'; void main() { new Timer.periodic(new Duration(seconds:1),(t)=>print(Store.x)); new Timer.periodic(new Duration(seconds:3),(t)=>Store.x='initalized'); } class Store{ static String _x =...
twitter-bootstrap,dart,bootjack
After looking at the classes on a working navbar while toggling it a couple of times, I've realised it's pretty simple - adding in / out to the classes makes the navbar pop in / out when in mobile view. ButtonElement navbarToggle = querySelector("button.navbar-toggle"); navbarToggle.onClick.listen((e){ DivElement menu = querySelector("div.navbar-collapse"); if...
I think you forgot to pass the values into conn.execute(). Try changing this line: conn.execute('insert into users values(@login, @password)') to this: conn.execute('insert into users values(@login, @password)', values) ^^^^^^ Also, I'd recommend storing salted password hashes rather than plaintext strings. Here's a good starting point: How can I hash passwords in...
unit-testing,testing,dart,dart-polymer
The annotation @whenPolymerReady on main() is missing. Also the test transformer (explained in the README.md of the test package) should be added to the transformer section in pubspec.yaml.
Your example code from the PostgreSQL driver means that the query() method expects two arguments, a string and a map. Your 2nd example seems to try to do string interpolation. In Dart this would look like var id = 5; var string = 'select color from crayons where id =...
See the API for List.map and the API for Iterable (which it returns). You can get the nth element from the iterable using .elementAt(n) or the first element using .first. var list = [{'id':3, 'name':'third'},{'id':4, 'name':'fourth'}]; var result = list.map((x) => x['id']).first; You can also turn it back into a...
javascript,dart,google-chrome-app,content-security-policy
In a package app for Chrome you can not use the fields "content_scripts", "content_security_policy" and "tabs". Dart also does not support script injection dynamically. As explained here: Will there be a dynamic code injection for dart? To use JS code must save it locally, import it into your html code:...
You can configure this behavior in the Polymer transformer config in the pubspec.yaml file like transformers: - polymer: entry_points: ... inline_stylesheets: web/asset/examples.css: false lib/asset/smoothness/jquery-ui-1.8.16.custom.css: false ...
Why are you not running a web server? You could just run pub serve web from the package folder (where the pubspec.yaml file is) and load the page from http://localhost:8080/piratebadge.html. Your <Dart-SDK>/bin directory needs to be added to your systems PATH in order to make pub serve web work. If...
I'm pretty sure the problem is that your code is executed before Polymer is initialized. See http://stackoverflow.com/a/20982658/217408 how to initialize Polymer when you have a custom main method.
string,dart,diacritics,unaccent
Not throughougly tested but seems to work void main() { var paragraph = "L'avantage d'utiliser le lorem ipsum est bien évidemment de pouvoir créer des maquettes ou de remplir un site internet de contenus qui présentent un rendu s'approchant un maximum du rendu final. \n Par défaut lorem ipsum ne...
asynchronous,stream,dart,stdout
addStream returns a Future that indicates when the adding of the stream is done. There should only be one stream that addStreams at the same time to a StreamSink. Depending on what you want/need to do, you have 2 options now: multiplex the output of the process(es) into stdout. await...
dart,dart-polymer,dart-pub,dart2js
You don't need initPolymer when you use @whenPolymerReady. The entire main() method is redundant in your example. Did you register your entry page properly in the Polymer transformer configuration in pubspec.yaml? Smoke needs a transformer but if you have the Polymer transformer configured properly the Smoke transformer is included....
When an new Polymer.dart version is built on a new Polymer.js version they usually add the information to the CHANGELOG.md at https://pub.dartlang.org/packages/polymer Polymer 0.8 will be available "soon" for Dart but as usual with Google they don't provide concrete dates....
This is a known issue with the Dart version of pub.dartlang.org (was Python until recently) https://github.com/dart-lang/pub-dartlang-dart/issues/16
The cache might be from dart:io. You should probably launch a pub serve instance and redirect to this during development anyway. This way any transformers (Angular, Polymer, ...) are applied as well. When deployed the server should serve the build output of the client.
dart,dart-mirrors,dart2js,dart-sdk
Looks like this is a known issue: github.com/dart-lang/sdk/issues/21927
At first, I think you should add the @whenPolymerReady annotation to main() instead of your Polymer initialization code. Instead of expect(document.querySelector('qme-header').shadowRoot .querySelector('#headerErrorDiv'), isNotNull); you could use expect(document.querySelector('qme-header::shadow #headerErrorDiv'), isNotNull); I don't see a problem in your cod. Can you please provide a complete example that allows to reproduce your problem...
It seems you can only use toEncodable: OR the toJson() fallback. If you wrap your Date in a class which provides toJson() you don't need to use toEncodable:: class JsonDateTime { final DateTime value; JsonDateTime(this.value); String toJson() => value != null ? value.toIso8601String() : null; } class Post { ......
dart,dart-polymer,paper-elements
There are no 1.0 elements for Dart yet. This is work in progress and before they are not published there is no way to use them the way you did previously. You can use the Polymer.js elements in the meantime of course but then you have to use bower and...
The (y) => () => renderLine(y) is a function that returns a function. If you write it without the => shorthand, it is the same as: (y) { return () { return renderLine(y); }; } This means that the List.generate calls this function 100 times, with different values for...
You need to register the onClick listen to remove the current item on every button. Here's a working version of your code. import 'dart:html'; InputElement toDoInput; UListElement toDoList; void main() { toDoInput = querySelector('#to-do-input'); toDoList = querySelector('#to-do-list'); toDoInput.onChange.listen(addToDoItem); } // Add item to list void addToDoItem(Event e) { final toDoItem...
app_gobals.html <link rel="import" href="packages/polymer/polymer.html"> <polymer-element name="app-globals"> <template> <style> :host { display: none; } </style> </template> <script type="application/dart" src="app_globals.dart"></script> </polymer-element> app_gobals.dart import 'package:polymer/polymer.dart'; import 'dart:async' show Timer; @CustomTag('app-globals') class AppGlobals extends PolymerElement { static final ObservableMap _staticValues = toObservable({}); Map get...
class Foo { final Bar _bar; Foo({Bar bar}) : _bar = bar != null ? bar : new Bar(); } ...
I think that you cannot do this because JetBrains IntelliJ Idea Community Edition does not intended for such use (web development). Community Edition A free and open-source IDE for Java, Groovy, Scala and Android development. Ultimate Edition A complete toolset for web, mobile and enterprise development....
There seems to be something weird with your dashes. When I copy the source from your question dartpad and WebStorm add a lot of spaces before the -. Try to remove and re-add them.
I don't think using bound variables for column names (same for table names, index names, ...) is supported by the SQL standard. These names need to be hardcoded in the SQL statement using for example String concatenation or interpolation. But ensure you don't use any values from user input here...
android,dart,httprequest,api-design,dart-pub
The html package is a HTML parser which allows to work with HTML server side. I wouldn't expect it to get some HttpRequest capabilities. The http package aims to provide a unified API for client and server Dart code. The API in dart:html is only a wrapper over the API...
data-binding,dart,polymer,dart-polymer
import 'package:template_binding/template_binding.dart' as tb; ... void deleteAttribute(Event event, Object detail, Node sender) { tb.TemplateInstance ti = tb.nodeBind(event.target).templateInstance; var value = ti.model.value as Attribute; attribs.remove(value); } See In Polymer.js children of a template have a reference to the template, how can this be done in Polymer.dart for more details....