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 Dart-Editor you just have to refresh the page.
Is it possible to get this working without the editor?
Thanks!
You can use pub serve which is similar to the webserver integrated in the Darteditor.
If you are using Dartium as browser you can add --no-dart2js so pub serve doesn`t generate JavaScript (which is slow) but directly serves Dart which Dartium can process directly.
For other browsers it's of course convenient to use the integrated dart2js conversion.
Related
I'm using Dart to build JS applications that are loaded on web pages hosted from an ASP.NET Core application, and I'm trying to establish a development workflow with either pub serve or potentially pub build that allows for debugging. I've seen some related posts, but I'm still stuck. This is what I've tried:
I used pub build with dart2js and the --mode=debug flag set to generate dart sources and a sourceMap, and then used Chrome to load and debug the web pages. The problem here, apart from long compile times, is the sourceMaps don't seem to work well for the debugging. Lines in the .dart files are often unavailable for debugging, and stepping over function calls doesn't work well, instead diving into framework code. I'm also unable to see values reported reliably.
I used pub get with the --packages-dir flag to copy in dependencies and then loaded the web pages with Dartium hosted by the IIS Express server. This loads pages fine and lets me develop, but I was unable to get breakpoints working at all in Dartium unless I used the debugger() statement directly in my code. I'm also concerned about this approach in general because Dartium is no longer being updated and the Dart team's plan is to move away from it.
As an offshoot of #2, I also tried simply changing my script tag URLs in my ASP.NET pages to point to the resources on the pub serve dev server. This is blocked because pub serve apparently only serves on http, and the ASP.NET application is hosted via HTTPS locally. I tried to change the backend to load on HTTP, but now I'm running into issues with authentication/authorization not working in my .NET app. Also, I had hoped to be able to use dartdevc with this approach, but that gave me 404 errors with requirejs, I think because it was trying to load it from the IIS Express server instead of pub serve (I'm really not sure about that).
I've found some mentions in other StackOverflow posts of setting up some sort of proxying behavior in order to have a backend server request resources from pub serve, but I have no idea how this might be done or if it applies to this situation. I can't find any information.
What strategies are people using for this, and is there a best-practice in mind going forward with Dart 2.0 and dartdevc?
I’m new to Dart and I’m going through the server tutorial (https://dart-lang.github.io/server/codelab/). For some reason, the final application is working fine when accessed from the Chrome browser (Windows, Version 57.0.2987.133 (64-bit)) and Firefox (47.0.2), but not in Dartium (=Chromium, Version 45.0.2454.104). When requested from Dartium, the server provides the html page, but it is static. The Dart code behind it (e.g. web/piratebadge.dart) doesn’t seem to execute at all.
However, if I run a simple client-based application (like https://webdev.dartlang.org/codelabs/angular_components) and serve it using pub serve, it works fine both in Dartium and in Chrome.
Any ideas what might be wrong?
Is there an "Angular/Dart" way to detect older unsupported browsers and prevent to continue with an elegant message (there are plenty of examples using javascript) rather than continue and show a weird layout with code that doesn't work?
Even the angulardart.org/demo site should do this IMO to stop IE8 (I know, but some enterprise customers still have those old browsers installed - and set as default - for legacy apps) from showing content that doesn't even work.
If Dart code cannot be executed the test has to be done in Js. I'm not aware of a library that makes this test.
The test should follow What browsers do you support as JavaScript compilation targets?.
Is there any way to test a code with dart:html imported on it, without dartium being triggered.
I want to test HttpRequest to a JSON data and expected it to display it on terminal, and dart editor wants to open dartium EVERYTIME, which i think unnecessary.
Dartium contains the browser hosted Dart VM, which the relevant browser DOM bindings. When you run code that needs a browser DOM, such as dart:html, you will get Dartium running.
However, you can also use DumpRenderTree - which is a headless browser (ie, produces output to the console).
Take a look at these post for more about DumpRenderTree and Dart:
http://work.j832.com/2013/01/headless-browser-testing-dart.html
http://docs.drone.io/dart.html
http://japhr.blogspot.co.uk/2013/01/regression-testing-of-browser-dart-code.html
Is there any way to run Silverlight tests without opening the browser? It takes some time to open the browser. if you are doing TDD, you may not like it.
I don´t think so.
for Silverlights Sandbox has to be astablished to test apainst and the sandbox does life in the browser , I can´t see a way to achiev this.
Regards Ren
You can test the Out Of Browser (OOB) version of your application instead. To do this, add a call to Application.Install() within your application, run it, and then in Visual Studio debug the Silverlight project itself rather than the ASP.NET project.
Once installed, you can also run the OOB version of the application from the command-line using "sllauncher.exe". To get the right parameters for sllauncher, look at the properties of the shortcut the installer creates for your app.
Even though you can use the sllauncher.exe - it still runs in using an IEFrame - hence effectively still uses a browser to host the SL sandbox. Sure, you won't see the browser in the regular sense.