tag:blogger.com,1999:blog-16366011910775610712016-12-08T01:25:21.964-08:00Dart News & UpdatesDart is an open-source, scalable programming language, with robust libraries and runtimes, for building web, server, and mobile apps.Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.comBlogger395125tag:blogger.com,1999:blog-1636601191077561071.post-78964199708938829072016-12-07T09:30:00.002-08:002016-12-07T09:39:46.807-08:00Enhancing the Flutter developer experienceAt the Dart Developer Summit <a href="http://news.dartlang.org/2016/11/flutter-best-mobile-development.html">we introduced</a> our fast and powerful Flutter developer experience. But our ambitions don’t stop here, so we have been hard at work developing several updates that further improve the experience.<br /><br /><h2>Faster startup during development</h2><br />Hot reload means you only have to launch your app once; after that changes are simply reloaded into the running app. But even that initial launch should be really fast. Previously we used a loader application to bootstrap the device with your application sources. Thanks to recent improvements made to the reload engine inside the VM this is no longer necessary and your application will be booted immediately, and you will see the real launch experience of your app.<br /><div><br /></div><div><h2>IntelliJ improvements</h2><div><br /></div><div>We have published an update to our IntelliJ plugin, version 0.1.6 that has several exciting <a href="https://plugins.jetbrains.com/plugin/9212?pr=idea">changes</a>:</div><div><ul><li>Launching the app with hot reload support (see details below)</li><li>A new flutter action pane has been added on flutter.yaml files (see details below)</li><li>Keyboard shortcuts were added for hot reload and restart:</li><ul><li>Hot reload: <span style="color: #6aa84f; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>ctrl \</b></span> or <span style="color: #6aa84f; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>ctrl alt ;</b></span></li><li>Restart: <span style="color: #6aa84f; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>ctrl shift \</b></span> or <span style="color: #6aa84f; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>ctrl shift alt ;</b></span></li></ul><li>Flutter doctor now prints out the IntelliJ plugin version numbers</li><li>Improved the robustness of starting and stopping program runs</li></ul></div><div><br /></div><h3>Launching the app with hot reload support</h3><div><br /></div><div>We have updated the behaviour of the IntelliJ Run and Debug buttons to both launch the app with Hot Reload support. If you want to run without hitting breakpoints, click the ‘Run’ button. If you want to trigger breakpoints, click the ‘Debug button’.&nbsp;</div></div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-NZG9A1kzKEY/WEgv1A3buzI/AAAAAAAACDs/MtcPyT0ehAYpi4V8QK-u3TNUPcZSb6QaQCLcB/s1600/main-toolbar.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="57" src="https://4.bp.blogspot.com/-NZG9A1kzKEY/WEgv1A3buzI/AAAAAAAACDs/MtcPyT0ehAYpi4V8QK-u3TNUPcZSb6QaQCLcB/s400/main-toolbar.png" width="400" /></a></div><div><br /></div><div><h3>Flutter specific action bar on flutter.yaml files</h3><div><br /></div><div>A custom action bar has been added for <span style="color: #073763; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>flutter.yaml</b></span> files. This allows you to <a href="https://flutter.io/upgrading/">upgrade</a> your flutter installation, and to run the <a href="https://flutter.io/bug-reports/#provide-some-flutter-diagnostics">doctor</a> command for troubleshooting.&nbsp;</div></div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-Wg8GGMgwlCI/WEgvjyRFePI/AAAAAAAACDo/HFyfOuqgjSceop75Z8njesm8dg9R4QuZACLcB/s1600/Screen%2BShot%2B2016-12-07%2Bat%2B15.45.54.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="77" src="https://1.bp.blogspot.com/-Wg8GGMgwlCI/WEgvjyRFePI/AAAAAAAACDo/HFyfOuqgjSceop75Z8njesm8dg9R4QuZACLcB/s640/Screen%2BShot%2B2016-12-07%2Bat%2B15.45.54.png" width="640" /></a></div><div><br /></div><div><h2>Updates to reload semantics</h2><div><br /></div><div>In Todd and John’s <a href="https://www.youtube.com/watch?v=iPlPk43RbpA&amp;feature=youtu.be&amp;list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2">Dart Developer Summit talk</a> they discussed the semantics of hot reload. Since giving the talk there have been some important updates that refine the semantics of reload to improve the developer experience.</div><div><br /></div><h3>Const fields are always reloaded</h3><div><br /></div><div>Changes to fields that are marked const can now be reloaded. For example:</div><div><br /></div><div><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp;const animationDuration = const Duration(seconds: 1);</b></span></div><div><br /></div><div><b>*reload*</b></div><div><br /></div><div><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp;const animationDuration = const Duration(seconds: 2);</b></span></div><div><br /></div><div>After the reload animationDuration will have the duration of two seconds. You can keep making changes and each time you reload, your program will use the updated value.</div><div><br /></div><h3>New instance fields have their initializing expressions run</h3><div>When you add a new instance field with an initializing expression, the VM will run that expression and assign the result to the instance field for all instances of the class. For example:</div><div><br /></div><div><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp;class Foo {</b></span></div><div><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp; &nbsp;...</b></span></div><div><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp;}</b></span></div><div><br /></div><div><b>*reload*</b></div><div><br /></div><div><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp;class Foo {</b></span></div><div><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp; &nbsp;...</b></span></div><div><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp; &nbsp;String myTitle = ‘My Title String’;</b></span></div><div><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp;}</b></span></div><div><br /></div><div>After the reload all instances of Foo will have the new field myTitle and it will contain ‘My Title String’. This is different than John and Todd’s talk which said myTitle will contain null.</div><div><br /></div><h4>When are initializing expressions run?</h4><div>Initializing expressions are run as the last stage of a hot reload. Note that the call stack may not be empty. After we have safely performed the reload we find all instances of the class and run the initializing expression and store the result in the field. The VM will do this for all classes that received new fields but in no particular order.</div><div><br /></div><h4>Initializing expressions with side effects</h4><div>Your initializing expressions can have side effects but the VM does not run the initializing expression against instances in a particular order. In other words, you cannot guarantee that a certain instance will have the initializing expression run before any other instance.</div><div><br /></div><h4>Initializing expressions that throw</h4><div>If an initializing expression throws we log that it threw and leave the field as null.</div><div><br /></div><h2>Updating and feedback</h2><div><br /></div><div>To try out these enhancements, please update your flutter IntelliJ plugin (you should be prompted in IntelliJ; if not, select the menu item&nbsp;<span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>IntelliJ &gt; Check for updates...</b></span>&nbsp;and upgrade from there.). Next update your flutter installation by running&nbsp;<b><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">flutter upgrade</span></b>&nbsp;in a terminal, or by using the <span style="color: #073763; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>flutter.yaml</b></span> action bar discussed above.&nbsp;</div><div><br /></div><div>Should you see any issues, or have suggestions or enhancement, please let us know in the <a href="https://github.com/flutter/flutter-intellij/issues">issue tracker</a>!</div></div><div><br /></div>Michael Thomsenhttps://plus.google.com/112973157970974566545noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-12143474919334636652016-12-07T09:17:00.000-08:002016-12-07T09:17:54.085-08:00Dart 1.21: Generic Method SyntaxDart 1.21 is now available. It introduces support for generic method syntax along with a few popular convenience features. <a href="https://www.dartlang.org/install">Get it now!</a><br /><br /><h3>Generic method syntax</h3><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-BZ7O1VACdwM/WEglT0ExynI/AAAAAAAACDQ/iLu_-SZRmjYwqs3SQCdnDdlqaHVzLBOTwCLcB/s1600/GenericMethods.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://4.bp.blogspot.com/-BZ7O1VACdwM/WEglT0ExynI/AAAAAAAACDQ/iLu_-SZRmjYwqs3SQCdnDdlqaHVzLBOTwCLcB/s1600/GenericMethods.gif" /></a></div><span id="goog_1834114606"></span><span id="goog_1834114607"></span><br /><br />Until now, Dart's generic support was limited to classes, such as <span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>List&lt;T&gt;</b></span>. Dart 1.21 introduces syntax allowing type arguments on methods and functions.<br /><br /><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;">&nbsp; &nbsp;T first&lt;T&gt;(List&lt;T&gt; ts) {</b><br /><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;">&nbsp; &nbsp; &nbsp;return ts.length == 0 ? throw new ArgumentError('Empty list!') : ts[0];</b><br /><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;">&nbsp; &nbsp;}</b><br /><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;"><br /></b>Note the return type, <span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>T</b></span>. This enables call sites to preserve type information from arguments. Try to write the same function without a type argument, and you'll see that the return type must be <span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>Object</b></span> – there is no other way we can make it work on all lists. For more examples, check out the <a href="https://github.com/dart-lang/sdk/blob/master/pkg/dev_compiler/doc/GENERIC_METHODS.md">Using Generic Methods article</a>. For even more details, the <a href="https://gist.github.com/eernstg/4353d7b4f669745bed3a5423e04a453c">informal specification</a> is the place to go.<br /><br />We've had generic methods and functions for a while in <a href="https://github.com/dart-lang/sdk/blob/master/pkg/dev_compiler/STRONG_MODE.md">strong mode</a>. 1.21 introduces support for generic method syntax even without strong mode. Libraries can use this feature and work in both contexts, providing a stepping stone to full generic methods in all Dart code.<br /><br />However, this feature does not yet provide full runtime support for generic methods outside DDC. In particular, <b>type arguments are not reified</b> (i.e., they have no representation at runtime). Libraries must avoid constructs where the runtime value of type arguments matters, in order to work in both modes. For example, <b><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">x is T</span></b> will not work outside strong mode if <b><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">T</span></b> is a method type argument. The analyzer marks such cases as errors, so you'll have tool support to avoid them. (Note: If you are using IntelliJ, support is available in <a href="https://confluence.jetbrains.com/display/WI/WebStorm+EAP">WebStorm 2016.3.2 RC</a> / <a href="https://confluence.jetbrains.com/display/IDEADEV/IDEA+2016.3+EAP">IntelliJ IDEA 2016.3.1 RC</a>, and later.)<br /><br /><div><h3>Convenience features</h3><div><br /></div>1.21 also introduces a couple of <a href="https://github.com/dart-lang/sdk/issues/27559">much</a> <a href="https://github.com/dart-lang/sdk/issues/26655">requested</a> convenience features. You can now use <span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>=</b></span>&nbsp;to specify a default value for a named argument.<br /><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;"><br /></b><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;">&nbsp; &nbsp;enableFlags({bool hidden: false}) { … }</b><br /><br />can now be replaced by<br /><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;"><br /></b><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;">&nbsp; &nbsp;enableFlags({bool hidden = false}) { … }</b><br /><br />We’re also introducing <a href="https://gist.github.com/eernstg/cff159be9e34d5ea295d8c24b1a3e594#file-initializing_formal_access-md">access to initializing formal</a>s, e.g., <span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>x</b></span> is now in scope in the initializer list such that we can use it to initialize <span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>y</b></span> in this example:<br /><br /><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp;class C {&nbsp;</b></span><br /><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp; &nbsp;var x, y;&nbsp;</b></span><br /><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp; &nbsp;C(this.x): y = x;&nbsp;</b></span><br /><span style="color: #3d85c6; font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>&nbsp; &nbsp;}&nbsp;</b></span><br /><br />As with any new language feature, it is critical for package authors to update <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>pubspec.yaml</b></span> with a latest SDK version.<br /><br /><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;">&nbsp; &nbsp;name: my_cool_dart_package</b><br /><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;">&nbsp; &nbsp;environment:</b><br /><b style="color: #3d85c6; font-family: &quot;Courier New&quot;, Courier, monospace;">&nbsp; &nbsp; &nbsp;sdk: '&gt;=1.21.0 &lt;2.0.0'</b><br /><br />This ensures users on older SDKs aren't broken when they update their packages.<br /><br />For more details on these and other changes in 1.21, see the full <a href="https://github.com/dart-lang/sdk/blob/master/CHANGELOG.md#1210">changelog</a>. Otherwise, <a href="https://www.dartlang.org/install">download the latest release</a>, and <a href="https://www.dartlang.org/community">let us know</a> what you think!</div><div><br /></div>Michael Thomsenhttps://plus.google.com/112973157970974566545noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-49462504216862947102016-12-05T07:00:00.000-08:002016-12-05T07:00:13.379-08:00StageXL 1.0: a chat with Bernhard PichlerTo contribute to the celebration of the recent <a href="https://medium.com/@bp74/stagexl-1-0-a9c5ff22a534#.96w9m2pxd">1.0 launch</a> of <a href="http://www.stagexl.org/">StageXL</a>, we had a chat with <a href="https://plus.google.com/+BernhardPichler">Bernhard Pichler</a> to learn more. Here we go.<br />---<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-vqInbB4z-U4/WEV9g7hlK4I/AAAAAAAAFPE/GkzgVZBCxHs6OzV2jDzutfjQGlZhrYoZACEw/s1600/stagexl-demo-30fps.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://2.bp.blogspot.com/-vqInbB4z-U4/WEV9g7hlK4I/AAAAAAAAFPE/GkzgVZBCxHs6OzV2jDzutfjQGlZhrYoZACEw/s1600/stagexl-demo-30fps.gif" /></a></div><br /><br /><i>First and foremost huge congrats on the 1.0 launch! People are already raving over it on <a href="https://news.ycombinator.com/item?id=13100370">Hacker News</a> and <a href="https://www.reddit.com/r/programming/comments/5gby3x/stagexl_10_same_api_as_flash_but_open_source_runs/?st=iwc6kkpc&amp;sh=8dce7a71">Reddit</a>. This is really a great accomplishment. I was wondering if you could start by telling us a bit about who you are?</i><br /><br />Thanks. Sure. My name is Bernhard Pichler, I'm 42 years old and I'm from Austria - you know Sound Of Music but no kangaroos. In my day job I work as a developer for a company in the gaming and betting industry. Nowadays I mostly do stuff on the backend but I used to work on the frontend in the past. That's why I still love to do computer graphics and why I work on StageXL in my spare time.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-CpqtXWXgEjw/WEV-G_xRYyI/AAAAAAAAFPI/QqDtoorLGjM-jKgR3rc9WIp9ClkQ8rhIwCLcB/s1600/Foto%2BEX.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://2.bp.blogspot.com/-CpqtXWXgEjw/WEV-G_xRYyI/AAAAAAAAFPI/QqDtoorLGjM-jKgR3rc9WIp9ClkQ8rhIwCLcB/s320/Foto%2BEX.jpg" width="320" /></a></div><br /><i>How would you explain in less than 54 words, what StageXL is?&nbsp;</i><br /><br />StageXL is a 2D rendering engine mainly built for casual games. Games like Farmville or Bejeweled are good examples. More people are playing this kind of games than those who play high budget AAA titles. StageXL basically provides an API to draw images to the screen in a very fast and flexible way.<br /><br /><i>What would you say is the main benefit of using StageXL for me as a developer?</i><br /><br />As a game developer you always ask for more speed and more features. To do this you have to write code as close to the metal as possible. Since we are talking about the browser, your best option is to use WebGL. StageXL bridges the gap between WebGL and an easy to use API for the developer. You don't have to worry about the shader language, texture atlas management or draw call batching for example. StageXL uses best practices for game development and is highly optimized for this use case.<br /><br /><i>Cool. I'm kind of curious about the story behind StageXL. Could you say a bit about how it all started?</i><br /><br />I have to start at the very beginning. More than 25 years ago I started to do so called demos. A demo is a small computer program that generates visually appealing computer graphics, mostly written in assembler language. After school I got a job to write games for gaming terminals, called Photo Play, which where placed in amusement arcades and bars all over Europe. I did this for many years and as a funny side note I worked there with a guy called Daniel Sperl, who later did the Starling rendering engine for Flash and Adobe AIR. When Dart was announced, I think it was 2011 or so, I thought it would be fun to write a similar rendering engine that is based on HTML5 and Dart. It started as an experiment but soon I got pretty obsessed to improve and push it as much as possible.<br /><br /><i>What use of StageXL are you most proud of or impressed by?</i><br /><br />I was very proud when Adobe presented the <a href="http://news.dartlang.org/2013/05/adobes-flash-pro-cc-exports-to-dart-and.html">Flash Pro exporter for Dart and StageXL</a> at Google I/O 2013. One company migrated their educational games for kids from Flash to Dart and StageXL, another guy migrated an application that teaches how to read and play sheet music. Ever since StageXL grew a lot and is mostly used without Adobe Flash as a design tool. Tools like Spine for 2D animations are amazing and I'm proud that StageXL has full support for such tools. Other than that I get excited every time I see a project using StageXL. Recently someone used Apache Cordova to build a card game for the play store, which is pretty cool.<br /><br /><i>What new or coming StageXL feature are you most excited about?</i><br /><br />Without a doubt this is support for Flutter. Today, developers are using frameworks like Adobe AIR and Unity to build mobile games, but wouldn't it be exciting to do this with Dart and StageXL? You can probably use the existing Flutter API to build simple games, but to be competitive with other frameworks you need access to OpenGL. Unfortunately, Flutter is still in an early stage and providing the OpenGL APIs is not on their immediate roadmap. All we can do is keep an eye on it and hoping for the best :)<br /><br /><i>Yeah, that sounds like a really exciting setup with great opportunities for developers. On that note, thanks very much for your time, Bernhard, and once again huge congrats on the <a href="https://medium.com/@bp74/stagexl-1-0-a9c5ff22a534#.o0h0mdpe5">StageXL 1.0 launch</a>!</i><br /><br /><br />Anders Thorhauge Sandholmhttp://www.blogger.com/profile/02074725733613485890noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-145189184777369082016-11-30T09:06:00.000-08:002016-11-30T12:29:22.780-08:00Dart Strong Mode and ahead-of-time compilationDart is increasingly being used as a cross platform language, and on most of these platforms ahead-of-time (AOT) compilation is a key part of the development and deployment story.<br /><br />The dynamic nature of Dart limits the effectiveness of ahead-of-time compilation, particularly as applications scale up in size. We therefore designed <a href="https://github.com/dart-lang/sdk/blob/master/pkg/dev_compiler/STRONG_MODE.md#strong-mode">Strong Mode Dart</a>&nbsp;to allow ahead-of-time compilers to generate better code by taking full advantage of the type information that programmers write. <br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-xpw-gD0nNi4/WD7EGZWAxGI/AAAAAAAAFCU/UEPiAEwxq-49zGIhl7tJo8Tzt7mrFtG_QCLcB/s1600/strong%2Bmode.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://3.bp.blogspot.com/-xpw-gD0nNi4/WD7EGZWAxGI/AAAAAAAAFCU/UEPiAEwxq-49zGIhl7tJo8Tzt7mrFtG_QCLcB/s400/strong%2Bmode.gif" width="400" /></a></div><br />While the initial goal of Strong Mode was to enable better ahead-of-time compilation, we've also seen strong uptake of Strong Mode from users who just like the stronger static checking because of it’s ability to make writing, reading, and refactoring Dart code more reliable.<br /><br /><div style="text-align: center;"><iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/DKG5CMyol9U?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2" width="560"></iframe><br /></div><div style="text-align: center;"><br /></div>The <a href="https://www.youtube.com/watch?v=DKG5CMyol9U&amp;list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&amp;index=3">recent talk</a> from the Dart Developer Summit gives an overview of Strong Mode: what it is, why having a sound type system is useful, and how it benefits developers by making their IDE experience better, and their errors more reliable.<br /><br />If you’re curious to try out Dart Strong Mode, <a href="https://dartpad.dartlang.org/">DartPad</a> makes it really easy: simply tick the Strong mode box in the lower right corner. <br /><br /><i>Posted by Leaf Petersen, Software Engineer and Dart Strong Mode Aficionado</i><br /><div><br /></div>Anders Thorhauge Sandholmhttp://www.blogger.com/profile/02074725733613485890noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-14070456275203635012016-11-28T14:42:00.000-08:002016-11-28T14:42:24.521-08:00AngularDart 2.1 and new Components<a href="https://angulardart.org/">AngularDart</a>&nbsp;got its own dedicated team 5 months ago. Last month, we launched 2.0 final on the Dart Developer Summit. Today, we’re releasing the first minor release after that: 2.1.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-oMj3Vx-6Htk/WDx8hfncZhI/AAAAAAAAORs/mFFdqJARol4f0c88OQebMwtb17blmWVVwCLcB/s1600/benchmark.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://1.bp.blogspot.com/-oMj3Vx-6Htk/WDx8hfncZhI/AAAAAAAAORs/mFFdqJARol4f0c88OQebMwtb17blmWVVwCLcB/s320/benchmark.png" width="320" height="144" /></a> </div>Since the focus of AngularDart is <a href="https://www.youtube.com/watch?v=8ixOkJOXdMo">Productivity, Performance, Stability</a>, there are no major breaking changes (see the <a href="https://github.com/dart-lang/angular2/blob/master/CHANGELOG.md">changelog</a>) — but a lot of behind-the-scenes improvements. Your apps will get slightly smaller and faster (even relative to 2.0 which already made huge strides in size and performance since the compiled-from-TypeScript days). <br /><br />Many features that AngularJS had to implement for JavaScript and TypeScript are not needed in Dart (because Dart already has those features out-of-the-box). So we’re removing them from AngularDart. Renderer is deprecated in favor of plain-old <a href="https://api.dartlang.org/stable/1.20.1/dart-html/dart-html-library.html">dart:html</a>. NgPlural is going away — Dart programs can use the <a href="https://pub.dartlang.org/packages/intl">package:intl</a> library.<br /><br /><strong>New components</strong><br /><br />On the Dart Developer Summit, we launched <a href="https://dart-lang.github.io/angular2_components_example/">AngularDart Components</a>&nbsp;— the material design widgets Google is <a href="https://www.youtube.com/watch?v=vAUUOwBJetg&list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&index=6">using</a>&nbsp;in customer-facing apps like AdWords&nbsp;and AdSense. Hundreds of Google engineers work with these components every day. <br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/--bExxEaKZsQ/WDx6xuriuKI/AAAAAAAAORU/Pk5gmrodX5UTyiAoSoeAMpC8eAKQF070QCLcB/s1600/image00.gif" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://1.bp.blogspot.com/--bExxEaKZsQ/WDx6xuriuKI/AAAAAAAAORU/Pk5gmrodX5UTyiAoSoeAMpC8eAKQF070QCLcB/s320/image00.gif" width="320" height="270" /></a></div>And today, we’re adding another component to the pack. Namely, <code>&lt;material-dialog&gt;</code>, a customizable modal window created with the <a href="https://www.google.com/url?q=https://material.google.com/components/dialogs.html&amp;sa=D&amp;ust=1480361992453000&amp;usg=AFQjCNEZaNURszq7b3ER2gkkzNhvLads1Q">material design principles</a>.<br /><br />Note: the open source AngularDart Components do not currently accept pull requests. They will in the future, and we do follow <a href="https://github.com/dart-lang/angular2_components/issues">GitHub issues</a>, of course.<br /><br />We hope AngularDart 2.1 and AngularDart Components will serve you well. Let us know&nbsp;what you think! <br />Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-51754049563087908412016-11-23T14:39:00.000-08:002016-11-23T17:21:42.152-08:00Making app development easier: Interview with Jerry Bowerman of sonarDesign<div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-0VNo8ox87r8/WDYYL_xCylI/AAAAAAAAON8/OEbolJCGzco8vLZabd8uXT2M6nWUiZ9BwCLcB/s1600/smartCitiesPuters.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://2.bp.blogspot.com/-0VNo8ox87r8/WDYYL_xCylI/AAAAAAAAON8/OEbolJCGzco8vLZabd8uXT2M6nWUiZ9BwCLcB/s400/smartCitiesPuters.png" width="400" height="272" /></a></div><em><a href="https://www.google.com/url?q=http://www.sonardesign.com/&amp;sa=D&amp;ust=1479943535489000&amp;usg=AFQjCNH5vSafhjgzzyPjtw4jT12Em6ABlg">sonarDesign</a></em><em>&nbsp;is an Austin-based company that builds an exciting app platform, in Dart. <a href="https://www.linkedin.com/in/jerrybowerman">Jerry Bowerman</a>, the company’s CEO, previously worked at Sierra Online, EA Sports and LucasArts. I asked him some questions about the company’s vision… and tech stack. — Filip Hráček</em><br /><br /><h3 id="h.ncvilife3ki3"><strong>Why did you start sonarDesign?</strong></h3>We believe the app store model is broken. It&#39;s a nice refinement of a 40 year old paradigm of installing and updating software. It introduces friction between the app creator and end user. The app store model served a purpose in the early days. I haven’t found anyone that actually enjoys the app-cycle (discovery, install, daily updates, deleting photos or apps to make space, etc.).<br /><br />The Sonar platform is a contrarian bet on the app store model. We believe for the majority of use cases, delivering apps instantly via open standards is the right model. The challenge for most app creators, however, is learning open standards, like HTML5, at the specification layer so you can deliver the performance required by modern users. Most app authors prefer to drag and drop components and create interactivity with no-code or low-code solutions. The Sonar platform gives you the performance low-level HTML5 with the ease of use of drag and drop design and no-code interactivity.<br /><br /><h3 id="h.j9adcopo2e1p"><strong>Is the vision you had when you started still valid in 2016? Is Creation as a Service a thing now?</strong></h3>I believe it is a thing now, but goes by several different names. Gartner, Forrester and other research companies call it Rapid Application Development. Famous Industries calls it micro-experiences, Facebook calls it React, etc. The mission of each is very similar: abstract all the tedious “guts” of app development so people can focus on creation. <br /><br />Setting up web servers, databases, communication servers, DNS, load balancers, is a time consuming pain. Even after completing all that, developers still end up supporting multiple code bases to produce multiple binaries for iOS, Android, Windows, etc. It’s horribly inefficient. The worst part, however, is after it is all said and done people are going to use your app a few times and after a month won’t be using it at all.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-3G12rQVtJBA/WDYaLL1CQKI/AAAAAAAAOOI/M93xwZmgqlIPBnYnyoHfoUMy_HQ5Jw2wgCLcB/s1600/020.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://4.bp.blogspot.com/-3G12rQVtJBA/WDYaLL1CQKI/AAAAAAAAOOI/M93xwZmgqlIPBnYnyoHfoUMy_HQ5Jw2wgCLcB/s320/020.jpg" width="320" height="320" /></a></div><h3 id="h.333810oge6gs"><strong>Building non-native apps powered by web technologies is a controversial approach. Why do you think it’s viable, technology-wise?</strong></h3>I think most people have long forgotten there was no app store when the iPhone launched. <br /><br />In fact, the app store didn’t arrive until a year later. A couple of weeks before the launch of the original iPhone Steve Jobs hastily arranged a meeting where he passionately implored developers to use “AJAX” to make web apps. He said HTML5 is the future. To underscore his point, he said several times that mobile Safari was a full featured browser on mobile, not a gutted “mobile friendly” browser prevalent on feature phones at the time. <br /><br />Of course we all know the truth: Safari on the original iPhone was slow, buggy and didn’t support much of the HTML5 specification. Fast-forward nine years, however, and mobile browsers do support most of the HTML5 specification, processor speeds are comparable with two year old laptops, and download speeds are way faster. Our 400KB client downloads in a couple seconds and delivers a native look and feel.<br /><br /><h3 id="h.uxf68tdzr9zd"><strong>What’s your current tech stack? How has it evolved over the years?</strong></h3>Our platform is hosted on AWS and so we take advantage of quite a few of their services for email, messaging, storage, data storage, CDN, DNS, load balancing, etc. We have an assortment of managed Linux/Nginx instances running PHP and Dart services. We use DynamoDB for unstructured data storage and Postgres/RDS for structured data storage. <br /><br />Our stack has been pretty consistent from the beginning. The only big change was moving from Mongo to DynamoDB a couple years ago. DynamoDB wasn’t available when we started the company back in 2012.<br /><br /><h3 id="h.g51tfxep2t6r"><strong>Does Dart give you any value that other technologies can’t?</strong></h3>Being able to work in a strong, typed, object oriented language is a huge value versus hand-writing JavaScript. Building features on top of existing Dart libraries is quicker than writing everything from scratch. Dart also does a good job of optimizing JavaScript and minifying it for final delivery. <br /><br /><h3 id="h.5g6spar09tw"><strong>Was it hard for you to find (or train) developers who know Dart?</strong></h3>I thought that was going to be a big issue but it really was not much of an issue. We only hired experienced developers with a solid understanding of object-oriented programming, code design, etc. New hires are usually over the syntax issues and productively writing code in a few days.<br /><br /><h3 id="h.69sxesa6kt8u"><strong>What’s the next big thing for your platform?</strong></h3>We have many important features we want to add over the next year such as alignment, 9-slice, exposing our Expression system visually, bitmap caching and so on, but the big thing for our platform is Components. Components are self-contained objects that you can share with other people, who can then extend the functionality, and share with more people. We introduced v1.0 of Components in our platform earlier this year but we plan to really blow it out over the next few months and into 2017. Imagine being able to share and extend art, code, audio and video without fear of theft? The Sonar platform tracks, authenticates, and delivers all the bits, which makes our Component system much different than asset stores using DRM.<br />Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-31671105422777167732016-11-23T04:14:00.000-08:002016-11-23T04:14:22.874-08:00Building web apps with Firebase and Dart<a href="http://www.moudra.net/">Jana Moudra</a> is one of the many developers who joined us for the Dart Summit this year. Not only was she helping organize the new, shiny <a href="https://webdev.dartlang.org/codelabs/angular2_components">Code Lab</a> showing off the brand new <a href="https://pub.dartlang.org/packages/angular2_components">AngularDart Components</a>, she was also giving a talk on “<a href="https://www.youtube.com/watch?v=naNr0F6mHjw&amp;list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&amp;index=10">How to build a Dart and Firebase app in 30 mins</a>”.<br /><br /><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-bH3NKsRPF1Q/WDWEu8YltbI/AAAAAAAAFAg/PVdCLslJGhMcohOdvnwplzkWz5pVTc2CACLcB/s1600/firebase-dart.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://1.bp.blogspot.com/-bH3NKsRPF1Q/WDWEu8YltbI/AAAAAAAAFAg/PVdCLslJGhMcohOdvnwplzkWz5pVTc2CACLcB/s1600/firebase-dart.png" /></a></div><br />We thought it’d be great to hear more about this and we’re therefore happy to share this brief chat with Jana.<br /><br />---<br /><i><br /></i><i>So, Jana, this was the second time you attended the Dart Summit. We were really pleased to have you join us again this year and very thankful for all your hard work, help, and support. In the interest of people who maybe weren’t able to be at the summit this year, I was wondering if you could talk a bit about your overall impression of the event?</i><br /><br />The Dart Developer Summit was a really great event and I was really happy there. I met a lot of Dart developers, had fun and saw really nice talks on topics which interest me. I filled my personal todo list with a lots of "must try" or "must explore" things. I am really looking forward to the next year's summit, see ya on a boat! :-D [You’ll need to watch the first minute of the <a href="https://www.youtube.com/watch?v=JXcNqXbCa0E&amp;list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&amp;index=1">keynote</a> to get the boat reference].<br /><br /><i>Sounds great. Really hope to see you for the summit again next year. Sounds like that’s not totally unlikely. R</i><i>egarding your talk at the summit about building Firebase and Dart apps. What would you say is the number one reason why developers should watch it?</i><br /><br /><div style="text-align: center;"><iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/naNr0F6mHjw?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2" width="560"></iframe><br /></div><br />When you implement some project, you usually need a backend which takes some time to implement. But what if you don’t have the time or don’t want to invest in development?<br /><br />This is exactly the reason why Firebase got my attention in the first place - I call it a “backend without implementing backend” but it’s even more.<br /><br />Dart makes me a very productive developer. So let’s take these two technologies together and <a href="https://github.com/Janamou/firebase-demo">see how easy it is to build</a> an application with Dart using a Firebase in a 30 mins!<br /><br /><i>So, you already talked a bit about new Dart-related “must try” and “must explore” things that you added to your list. Just being curious, I was wondering if you could reveal or talk a bit about what you are currently working on? That is, what is the next cool thing that we can look forward to?</i><br /><br />Sure! We are working on our company’s product which uses Dart on the frontend and Firebase on the backend. These technologies are great together. And also, I am planning to update the <a href="https://pub.dartlang.org/packages/firebase3">Firebase3 package</a> with support for Firebase Cloud Messaging and provide some more tutorials and examples on how to use it.<br /><br /><i>Awesome, can’t wait to learn more about that.</i><br /><i><br /></i><i>Thanks again for all your work on the Firebase3 package, an awesome talk at the summit, and for taking the time to have this chat.</i><br /><br />Thank you for all the great stuff you do! :-)<br /><div><br /></div>Anders Thorhauge Sandholmhttp://www.blogger.com/profile/02074725733613485890noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-24093908490963674702016-11-21T04:00:00.000-08:002016-11-21T13:51:08.168-08:00Dart Developer Summit 2016 Videos: Soundness, AngularDart 2.0, and the Fastest Growing Language at Google<img border="0" style="display:none" src="https://3.bp.blogspot.com/-XTruayezMzI/WDNsH1zrcgI/AAAAAAAAONA/P4uQ11g1G9k67M885NX0157-MAqRwBnwwCLcB/s1600/dds-2016-with-colors.gif" />Videos from last month’s Dart Developer Summit are <a href="https://www.google.com/url?q=https://www.youtube.com/watch?v%3DJXcNqXbCa0E%26index%3D1%26list%3DPLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&amp;sa=D&amp;ust=1479492251093000&amp;usg=AFQjCNGcO2IF8Ei2AnK0oYMQ1zX4lDHaYA">up on YouTube</a>&nbsp;and we thought we’d cherry-pick the highlights for you.<br /><br />The <a href="https://www.google.com/url?q=https://www.youtube.com/watch?v%3DJXcNqXbCa0E%26list%3DPLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2%26index%3D1&amp;sa=D&amp;ust=1479492251094000&amp;usg=AFQjCNF8TAnDttEMI4Lc1SKnigUqEtA_kg">summit keynote</a>&nbsp;is a summary of all the major news and of the direction the team is taking now. It’s where we announced that Dart is the fastest growing language at Google. Teams switching to Dart report up to twice the productivity and development speed of what they had previously.<br /><br /><iframe width="560" height="315" src="https://www.youtube.com/embed/JXcNqXbCa0E?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2" frameborder="0" allowfullscreen></iframe><br /><br />Next, <a href="https://www.google.com/url?q=http://angulardart.org/&amp;sa=D&amp;ust=1479492251097000&amp;usg=AFQjCNHIHdpB3WmwaKjN-2Ffmlbwtw8y7g">AngularDart 2.0</a>&nbsp;was <a href="https://www.google.com/url?q=https://www.youtube.com/watch?v%3D8ixOkJOXdMo%26list%3DPLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2%26index%3D2&amp;sa=D&amp;ust=1479492251097000&amp;usg=AFQjCNG3SwENorDxUpLcxThFOna5Qgtpwg">launched in a presentation</a>&nbsp;by Ferhat Buyukkokten and Matan Lurey. They showed how they made the framework’s output 40% smaller and 15% faster in the 4 months since AngularDart <a href="https://www.google.com/url?q=http://news.dartlang.org/2016/07/angulardart-is-going-all-dart.html&amp;sa=D&amp;ust=1479492251098000&amp;usg=AFQjCNH8cRK5ohY7TZLtiqqLTHc3Ozec5g">got its own dedicated team</a>. They also showed our 60 fps table using setState(), and the new testing framework called NgTestBed. <br /><br /><iframe width="560" height="315" src="https://www.youtube.com/embed/8ixOkJOXdMo?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2" frameborder="0" allowfullscreen></iframe><br /><br />Later in the day, Ted Sander launched <a href="https://www.google.com/url?q=https://dart-lang.github.io/angular2_components_example/&amp;sa=D&amp;ust=1479492251100000&amp;usg=AFQjCNFPV6GI3nf-uqBMKXAft1n1UM1wRA">AngularDart Components</a>&nbsp;— the material design&nbsp;widgets Google is using in customer-facing apps like AdWords and AdSense. Hundreds of Google engineers work with these components every day. <a href="https://www.google.com/url?q=https://www.youtube.com/watch?v%3DvAUUOwBJetg%26list%3DPLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2%26index%3D6&amp;sa=D&amp;ust=1479492251101000&amp;usg=AFQjCNGmWaC9vZal1oMCOhvEtGjL_8gEfg">Watch the video</a>&nbsp;to learn how they make our teams more productive, and our web apps more performant.<br /><br /><iframe width="560" height="315" src="https://www.youtube.com/embed/vAUUOwBJetg?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2" frameborder="0" allowfullscreen></iframe><br /><br />If you’re interested &nbsp;in language design, watch <a href="https://www.google.com/url?q=https://www.youtube.com/watch?v%3DDKG5CMyol9U%26index%3D3%26list%3DPLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&amp;sa=D&amp;ust=1479492251103000&amp;usg=AFQjCNG2tYMQU7Dkh477Dmix7Y7ae29LiA">Sound Dart</a>, a talk by Leaf Petersen&nbsp;in which he explains Dart’s strong mode. With strong mode, Dart’s type system becomes sound, so that when you write types they are guaranteed to be correct (while still allowing you to write dynamically typed code where you want the flexibility). This differentiates strong-mode Dart from many popular compile-to-JavaScript languages, and improves both performance and developer productivity.<br /><br /><iframe width="560" height="315" src="https://www.youtube.com/embed/DKG5CMyol9U?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2" frameborder="0" allowfullscreen></iframe><br /><br />Another presentation that made waves was the <a href="https://www.google.com/url?q=https://www.youtube.com/watch?v%3DMx-AllVZ1VY%26index%3D11%26list%3DPLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&amp;sa=D&amp;ust=1479492251105000&amp;usg=AFQjCNFAMCg6-7klALbhoQYqNAn9pJrZvw">Flutter keynote</a>&nbsp;from Day 2 of the summit. Eric Seidel impressed the audience by showing just how fast mobile development can be with Flutter.<br /><br /><iframe width="560" height="315" src="https://www.youtube.com/embed/Mx-AllVZ1VY?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2" frameborder="0" allowfullscreen></iframe><br /><br />After Eric’s talk, John McCutchan and Todd Turnidge went into details about Flutter <a href="https://www.google.com/url?q=https://www.youtube.com/watch?v%3DiPlPk43RbpA%26list%3DPLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2%26index%3D12&amp;sa=D&amp;ust=1479492251106000&amp;usg=AFQjCNE1B25uUZaeMOf3T2OSG7RaP-mHjA">hot reloading</a>. They also showed, for the first time, code rewind in Dart.<br /><br /><iframe width="560" height="315" src="https://www.youtube.com/embed/iPlPk43RbpA?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2" frameborder="0" allowfullscreen></iframe><br /><br />These are just 6 out of the 18 talks that are available on YouTube. For example, Will Ekiel’s talk titled <a href="https://www.google.com/url?q=https://www.youtube.com/watch?v%3DiPlPk43RbpA%26list%3DPLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2%26index%3D12&amp;sa=D&amp;ust=1479492251107000&amp;usg=AFQjCNHPsgRmJfLOkJKtWXLUYs3WDQxR9w">Learnings from building a CRM app at Google</a>&nbsp;gives&nbsp;a perspective on managing a product built with Dart&nbsp;and deploying it across both web and mobile. Another interesting practical presentation&nbsp;on using Dart in production&nbsp;is the one given by Faisal Abid and Kevin Birch about their <a href="https://www.google.com/url?q=https://www.youtube.com/watch?v%3Db0b5FtnB3vE%26index%3D9%26list%3DPLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&amp;sa=D&amp;ust=1479492251109000&amp;usg=AFQjCNF-wGdj_rzBKPZX8rtsDNWutPZ-IQ">large-scale JS-to-AngularDart rewrite</a>. And the list goes&nbsp;on.<br /><br />We’re very happy how the event went, and we’re already looking forward for next year’s summit. In the meantime, follow our blog, our Twitter account, our&nbsp;G+ page, or <a href="https://www.google.com/url?q=https://www.dartlang.org/community&amp;sa=D&amp;ust=1479492251110000&amp;usg=AFQjCNGKbLFHBg66HwZgv-WM9uJ266R69Q">join the conversation</a>&nbsp;in any other way. We want to hear from you.<br /><br />Thanks for building in Dart.<br /><img border="0" style="display:none" src="https://2.bp.blogspot.com/-iIOXxo-Bg48/WC83Fjt0NYI/AAAAAAAAOKc/tqHK7Olc8g8NMuoKtZwewikDNJ22ZiM1gCLcB/s640/1B4B1795%2B%25281%2529.jpg" width="640" height="426" /><br /><br /><em>Cross-posted from <a href="https://developers.googleblog.com/2016/11/dart-developer-summit-2016-videos.html">Google Developers Blog</a>.</em>Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-8170936699951106182016-11-18T09:03:00.000-08:002016-11-18T09:03:15.642-08:00Flutter: The best mobile development experience?Developing for mobile just got a lot more fun with <a href="http://flutter.io/">Flutter</a>’s live developer workflow. At the heart of this new workflow is the Dart VM’s latest feature ‘<a href="https://github.com/flutter/flutter/wiki/Hot-Reload">hot reload</a>’. Hot reloading your program allows you to update the code without restarting your application. Make changes to your program and see them instantly on your Android or iOS device.<br /><br />Many programming languages support updating the running program but these all suffer from limitations that make using the feature difficult and error prone. The Dart VM’s hot reload is safe and fast. First, we designed the system to be safe and be reversible. If we detect issues at reload time, the VM will restore the original source code as if nothing happened. It’s fast because you can import new libraries, create new classes, and even add fields to existing classes without restarting your application.<br /><br /><a href="https://www.youtube.com/watch?v=Mx-AllVZ1VY&amp;index=11&amp;list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2">Flutter</a> works naturally with hot reload and you can see your changes on your mobile device in less than a second. And because we reload the changes into the running app, you don’t need to waste time navigating back to where you were in the app. <b>We measure our development cycle in milliseconds!</b><br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-ksCkS5sbYLY/WC8rHBMHJXI/AAAAAAAAE_U/RmPnToBc7kwQB1IoPvv58HGt6E1ujabwgCLcB/s1600/hot-reload.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="440" src="https://1.bp.blogspot.com/-ksCkS5sbYLY/WC8rHBMHJXI/AAAAAAAAE_U/RmPnToBc7kwQB1IoPvv58HGt6E1ujabwgCLcB/s640/hot-reload.gif" width="640" /></a></div><br />In our <a href="https://www.youtube.com/watch?v=iPlPk43RbpA&amp;list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&amp;index=12">talk</a> we share some technical information on the implementation and do a deep dive on the semantics of Dart during a reload.<br /><br /><div style="text-align: center;"><iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/iPlPk43RbpA?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2" width="560"></iframe><br /></div><br />Some of the questions covered in the talk are:<br /><ul><li>What happens to static data?</li><li>What if functions are already on the stack when a reload occurs?</li><li>How do you handle adding an instance field to classes that have instantiated objects?</li></ul><b>There is even more exciting features coming to Flutter’s mobile developer experience</b>. The developer experience team is hard at work adding support for <b>fix-and-continue debugging</b>. Be sure to <a href="https://www.youtube.com/watch?v=iPlPk43RbpA&amp;list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&amp;index=12">watch</a> Todd’s exciting demo of this feature.<br /><br /><i>Posted by John McCutchan &amp; Todd Turnidge, Hot Reloaders</i><br /><div><br /></div>Anders Thorhauge Sandholmhttp://www.blogger.com/profile/02074725733613485890noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-34130350966384022132016-11-16T13:53:00.000-08:002016-11-16T13:53:11.255-08:00Aqueduct - a server-side web framework written in Dart<div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-zDc-kxRbtdI/WCzRv_xRwOI/AAAAAAAAOH0/C-n4ymUL4bQycuS7Pg3PK9ttM7vNaKH-QCLcB/s1600/1B4B4988.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://3.bp.blogspot.com/-zDc-kxRbtdI/WCzRv_xRwOI/AAAAAAAAOH0/C-n4ymUL4bQycuS7Pg3PK9ttM7vNaKH-QCLcB/s320/1B4B4988.jpg" width="320" height="213" /></a></div><em>On the Dart summit last month, Joe Conway gave a great talk about Aqueduct, a server-side web framework written in Dart by stable|kernel. We asked Sarah from stable|kernel to write a blogpost as well. &mdash; Filip Hráček</em><br /><br /><hr><br />After spending a year building <a href="https://aqueduct.io/">Aqueduct</a> in a relative vacuum, the stable|kernel team went into the Dart Summit with a lot excitement! Finally, we got to share our server-side web framework with the community it was built for: web and mobile developers who want to build an entire stack in Dart. If you missed <a href="https://twitter.com/joeconwaystk/">stable|kernel CEO Joe Conway</a>&nbsp;present Aqueduct at the Dart Summit, you can watch it <a href="https://www.youtube.com/watch?v=twr3cDFCeo4&list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2&index=16">here</a>.<br /><br />Our team began exploring Dart about 18 months ago and we quickly realized the potential for supercharging our team’s productivity due to Dart’s power and speed. In October 2015 <a href="http://blog.stablekernel.com/dart-google-language">Joe wrote</a>: “It is important to us and our clients that we use platforms that allow for a high degree of productivity, testability and maintainability. In order to identify a platform that we could become experts in that also delivered on these three things, we set out to evaluate the web server platform landscape and find a platform that fit our needs.”<br /><br />What appealed to us most about Dart:<br /><ul><li>Easily deployable, stand-alone virtual machine</li><li>An incredible set of libraries for building web servers</li><li>Asynchronous programming and reflection</li><li>A simple, elegant language that Swift, Objective-C and Java programmers would love</li></ul><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-pBJAsIS_Zas/WCzVJZTY3nI/AAAAAAAAOIM/hMYgnsgRNCo7DxjtD6Wr5G3KMCVszQ-ZACLcB/s1600/Screen%2BShot%2B2016-11-16%2Bat%2B13.51.45.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://3.bp.blogspot.com/-pBJAsIS_Zas/WCzVJZTY3nI/AAAAAAAAOIM/hMYgnsgRNCo7DxjtD6Wr5G3KMCVszQ-ZACLcB/s320/Screen%2BShot%2B2016-11-16%2Bat%2B13.51.45.png" width="320" height="94" /></a></div>While Dart had all of the fundamentals and a great standard library to support building web server applications, no one had built a cohesive tool like Ruby on Rails, or .NET and the Entity framework. We were looking to combine the productivity of tools like those with the Dart platform together for a the ultimate programming experience. So that’s where Aqueduct comes in. <br /><br />The purpose of Aqueduct is to provide a foundation to build full-stack solutions quickly, but without sacrificing long-term sustainability. All of the typical features necessary for a web server application are available out of the box.<br /><br />Some of the highlights:<br /><ul><li>Easy integration with CI tools</li><li>OAuth 2.0 Implementation and Endpoints</li><li>Logging</li><li>An ORM&nbsp;that makes writing queries more productive, but doesn’t get in your way.</li><li>Automatic OpenAPI specification generation</li><li>High quality documentation to quickly get the most out of Aqueduct</li><li>Tooling for database migration</li></ul><br />You can take a look at additional features <a href="https://github.com/stablekernel/aqueduct">here</a>&nbsp;and check out the tutorials <a href="http://stablekernel.github.io/aqueduct/">here</a>. <br /><br />&mdash; Sarah Woodward, stable|kernel<br />Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-52129166923623258522016-11-15T05:30:00.000-08:002016-11-15T05:30:57.587-08:00AngularDart: The best Angular for you?<a href="https://plus.google.com/+FerhatBuyukkoktenHome">Ferhat</a> and <a href="https://medium.com/@matanlurey">Matan</a> recently announced the release of AngularDart 2.0 with some pretty dramatic performance improvements at the Dart Developer Summit in Munich.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-R7pzgfeKzO0/WCsCpjFzZqI/AAAAAAAAE9o/kgeyaQ1v4BUgFmJNnxDKz9F3R2G1aUTEQCLcB/s1600/Dart%2BSummit%2B2016%2B-%2BAngularDart%2B2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://2.bp.blogspot.com/-R7pzgfeKzO0/WCsCpjFzZqI/AAAAAAAAE9o/kgeyaQ1v4BUgFmJNnxDKz9F3R2G1aUTEQCLcB/s640/Dart%2BSummit%2B2016%2B-%2BAngularDart%2B2.png" width="640" /></a></div><br />We figured we’d have a chat with them to better understand — straight from the horse’s mouth — what this means for developers looking to write a web app.<br /><br /><div style="text-align: center;"><iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/8ixOkJOXdMo?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2" width="560"></iframe></div><br /><i>What is the single most important reason for people to try out the new AngularDart 2.0 release?</i><br /><br />That would be better performance. And really — as we talked about at the Dart Summit recently — AngularDart is mainly about providing developers with three things: <b>Productivity, Performance, and Stability</b>.<br /><ul><li>AngularDart is an amazing framework for building web apps and we have internal teams reporting doubling their productivity.</li><li>With the new release just out, AngularDart output is 40% smaller and 10% faster.</li><li>Finally, with major teams depending on the framework for their products, we work hard to ensure stability throughout when implementing these improvements.</li></ul><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-F7i3YS_MYqk/WCsCZX84fNI/AAAAAAAAE9k/fiJ1C25J2Hsp9TFJrFiPcD6hf8ljcNX7gCLcB/s1600/Dart%2BSummit%2B2016%2B-%2BAngularDart%2B2%2B%25281%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://3.bp.blogspot.com/-F7i3YS_MYqk/WCsCZX84fNI/AAAAAAAAE9k/fiJ1C25J2Hsp9TFJrFiPcD6hf8ljcNX7gCLcB/s640/Dart%2BSummit%2B2016%2B-%2BAngularDart%2B2%2B%25281%2529.png" width="640" /></a></div><br /><i>Indeed, you announced some pretty awesome performance improvements both in terms of output size and speed. What were the key insights that allowed you make so dramatic improvements in such a short time?</i><br /><br />For size improvements, it was a combination of low hanging fruit like better whitespace compression, a focus on generating idiomatic Dart code, and refactoring to remove dynamic calls and abstraction layers where possible. For runtime performance, we have leveraged strong types and moved from “dirty checking” to a ComponentState model.<br /><br /><i>AngularDart 2.0 was just released. So I was wondering, is it stable enough that I can start using it today? I mean, you said that it has been used in production for several months. How does that work?</i><br /><br />Yes. We have major Ads products relying on this already, and they have been for months. We have thousands of tests to make sure that as we make further performance improvements, nothing breaks along the way.<br /><br /><i>Awesome. So what is the best place to go if I want to try this out or learn more?</i><br /><br />You can check out the <a href="https://www.youtube.com/watch?v=8ixOkJOXdMo&amp;index=2&amp;list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2">video</a> from our presentation at the 2016 Dart Summit. We also have codelabs that help you <a href="https://webdev.dartlang.org/codelabs/ng2">get started using AngularDart</a> and even one with the <a href="https://webdev.dartlang.org/codelabs/angular2_components">new AngularDart components</a> that Ted <a href="https://www.youtube.com/watch?v=vAUUOwBJetg&amp;index=6&amp;list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2">talked about</a> at the Summit. Finally, <a href="http://angulardart.org/">angulardart.org</a> is the place to go for the latest info on AngularDart.<br /><div><br /></div>Anders Thorhauge Sandholmhttp://www.blogger.com/profile/02074725733613485890noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-73490153452671830472016-10-27T06:27:00.001-07:002016-10-27T06:27:37.458-07:00Sub-second reloads for mobile developers with Flutter and DartDevelopers inside and outside of Google have told us they are looking for a better way to build apps that delight all their users, without having to build the app twice. To help, we&#39;ve been working closely with the Flutter team to build an open-source SDK that helps developers write beautiful UIs for all of mobile from a single codebase. Currently in <em>technology preview,</em> Flutter is being used by teams inside of Google.<br /><br />At the previous Dart Developer Summit, the Flutter team showed how they used Dart to render mobile graphics and spinning square. Fast-forward to today: the Flutter team demoed their near-complete&nbsp;implementation of material design and showed real apps built with Flutter running on iOS and Android.<br /><br /><a href="https://1.bp.blogspot.com/-d4wocUDES90/WBIArFfLWtI/AAAAAAAAODI/2D0tn37SiWUc4J1vnGom3OEGTYmmDyp4QCLcB/s1600/Screen%2BShot%2B2016-10-27%2Bat%2B15.26.40.png" imageanchor="1" ><img border="0" src="https://1.bp.blogspot.com/-d4wocUDES90/WBIArFfLWtI/AAAAAAAAODI/2D0tn37SiWUc4J1vnGom3OEGTYmmDyp4QCLcB/s640/Screen%2BShot%2B2016-10-27%2Bat%2B15.26.40.png" width="640" height="594" /></a><br /><br />Flutter is different than other mobile SDKs. It&#39;s built with a best-in-class text rendering engine and the same <a href="https://en.wikipedia.org/wiki/Skia_Graphics_Engine">2D-to-GL library</a>&nbsp;that Chrome (and others) use, which means its lowest layers are battle-hardened and proven. Flutter does not use the OEM widgets, instead it paints every pixel using its framework and graphics engine. This gives developers tremendous control and expressiveness across all of mobile. However, apps built with Flutter try to feel natural on iOS and Android; Flutter&#39;s framework embraces platform differences like scroll physics, iconography, fonts, and gestures.<br /><br />A key benefit of using Flutter is its extremely fast development cycle, thanks to the Dart VM and Flutter&#39;s functional-reactive framework. For both iOS and Android, hardware and emulators, developers using Flutter can experience sub-second&nbsp;dev cycles as they add and debug app UIs. The app&#39;s state is maintained during the reloads, which means developers can iterate very quickly without restarting their app for every change. &quot;We measure our dev cycles in milliseconds&quot;, said Eric Seidel, engineer on Flutter.<br /><br />The new Flutter plugin for IntelliJ was also announced. Building on the existing strong support for Dart on the JetBrains platform, the Flutter plugin helps you run, debug, and hot reload on mobile devices and emulators from within a full IDE.<br /><br /><a href="https://3.bp.blogspot.com/-wvh5_1HFBQA/WBH8lIAGpKI/AAAAAAAAOC0/L7S7cxe4iWQtb-aMpzbGmUZqaUeYShRHACLcB/s1600/image00.png" imageanchor="1" ><img border="0" src="https://3.bp.blogspot.com/-wvh5_1HFBQA/WBH8lIAGpKI/AAAAAAAAOC0/L7S7cxe4iWQtb-aMpzbGmUZqaUeYShRHACLcB/s640/image00.png" width="640" height="473" /></a><br /><br />Though much progress has been made, Flutter is still in <em>technology preview</em>. The Flutter and Dart teams are working to build out further features such as accessibility and a plugin architecture.<br /><br />To learn more about Flutter&#39;s tech preview, please visit <a href="https://flutter.io/">flutter.io</a> and <a href="https://github.com/flutter">github.com/flutter</a>.<br /><br />Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-71573424514759700762016-10-26T01:46:00.000-07:002016-11-03T03:00:52.238-07:00Dart in 2017 and beyond<div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-xPj_xm1G3Gk/WBBrItmo0zI/AAAAAAAAOBs/fmZ8Nsfp-o8iTKLUJvB6Jtdv7erXL6UTgCLcB/s1600/CvreUB4XgAAK5D_.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="180" src="https://3.bp.blogspot.com/-xPj_xm1G3Gk/WBBrItmo0zI/AAAAAAAAOBs/fmZ8Nsfp-o8iTKLUJvB6Jtdv7erXL6UTgCLcB/s320/CvreUB4XgAAK5D_.jpg" width="320" /></a></div>We’re here at the <a href="https://events.dartlang.org/2016/summit/">Dart Developer Summit</a>&nbsp;in Munich, Germany. Over 250 developers from more than 50 companies from all over the world just finished watching the keynote.<br /><br />This is a summary of the topics we covered:<br /><br />Dart&nbsp;is the fastest growing programming language at Google, with a 3.5x increase in lines of code since last year. We like to think that this is because of our focus on developer productivity: teams report 25% to 100% increase in speed of development. Google has bet its biggest business on Dart — the web apps built on Dart bring over $70B per year.<br /><br />Google AdSense recently launched a <a href="http://news.dartlang.org/2016/10/google-adsense-angular-dart.html">ground-up redesign</a>&nbsp;of their web app, built with Dart. Earlier this year, we <a href="http://news.dartlang.org/2016/03/the-new-adwords-ui-uses-dart-we-asked.html">announced</a>&nbsp;that the next generation of AdWords is built with Dart. There are more exciting Dart products at Google that we’re looking forward to reveal. Outside Google, companies such as Wrike, Workiva, Soundtrap, Blossom, DG Logic, Sonar Design have all been using and enjoying Dart for years.<br /><br />Our five year investment in this language is reaping fruit. But we’re not finished.<br /><br />We learned that people who use Dart love its terse and readable syntax. So we’re keeping that.<br /><br />We have also learned that Dart developers really enjoy the language’s powerful static analysis. So we’re making it better. With strong mode, Dart’s type system becomes sound (meaning that it rejects all incorrect programs). We’re also introducing support for generic methods.<br /><br />We have validated that the programming language itself is just a part of the puzzle. Dart comes with ‘batteries included.’ Developers really like Dart’s core libraries — we will keep them tight, efficient and comprehensive. We will also continue to invest in tooling such as pub (our integrated packaging system), dartfmt (our automatic formatter) and, of course, the analyzer.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-oe8SwZKxdqY/WBBqqim2RZI/AAAAAAAAOBo/q6nagVVkGFMlXAAd74BwDVf5QrgTxtJJQCLcB/s1600/material-input.gif" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="56" src="https://3.bp.blogspot.com/-oe8SwZKxdqY/WBBqqim2RZI/AAAAAAAAOBo/q6nagVVkGFMlXAAd74BwDVf5QrgTxtJJQCLcB/s320/material-input.gif" width="320" /></a></div>On the web, we have arrived at a framework that is an excellent fit for Dart: <a href="http://news.dartlang.org/2016/07/angulardart-is-going-all-dart.html">AngularDart</a>. All the Google web apps mentioned above use it. It has been in production at Google since February. AngularDart is designed for Dart, and it’s getting better every week. In the past 4 months, AngularDart’s output has gotten 40% smaller, and our AngularDart web apps got 15% faster.<br /><br />Today, we’re launching AngularDart 2.0 final. Tune in to the next session.<br /><br />With that, we’re also releasing — as a developer preview — the <a href="https://pub.dartlang.org/packages/angular2_components">AngularDart components</a> that Google uses for its major web apps. These Material Design widgets are being developed by hundreds of Google engineers and are thoroughly tested. They are written purely in Dart. (<a href="https://dart-lang.github.io/angular2_components_example/">Gallery.</a>)<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-w6MZm3Mcwro/WBBpVSJMhUI/AAAAAAAAOBc/2POuDkKy7wQaCJTmvOUodX-whV8NQuziwCLcB/s1600/Screen%2BShot%2B2016-10-26%2Bat%2B10.28.34.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="180" src="https://3.bp.blogspot.com/-w6MZm3Mcwro/WBBpVSJMhUI/AAAAAAAAOBc/2POuDkKy7wQaCJTmvOUodX-whV8NQuziwCLcB/s320/Screen%2BShot%2B2016-10-26%2Bat%2B10.28.34.png" width="320" /></a></div>We’re also making Dart easier to use with existing JavaScript libraries.&nbsp;For example, you will be able to use our tool to convert TypeScript .d.ts declarations into Dart libraries.<br /><br />We’re making the development cycle much faster. Thanks to Dart Dev Compiler, compilation to JavaScript will take less than a second across all modern browsers.<br /><br />We believe all this makes Dart an even better choice for web development than before. Dart has been here for a long time and it’s not going anywhere. It’s cohesive and dependable, which is what a lot of web developers want.<br /><br />We’re also very excited about <a href="https://flutter.io/">Flutter</a>&nbsp;— a project to help developers build high-performance, high-fidelity, mobile apps for iOS and Android from a single codebase&nbsp;in Dart. More on that tomorrow.<br /><br />We hope you’ll enjoy these coming two days. Tune in on the <a href="https://www.youtube.com/playlist?list=PLOU2XLYxmsILKY-A1kq4eHMcku3GMAyp2">live stream</a>&nbsp;or follow <a href="https://twitter.com/search?f=tweets&amp;vertical=default&amp;q=%23dartsummit&amp;src=typd">#dartsummit</a>&nbsp;on Twitter.Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-49857065094820821442016-10-17T07:14:00.000-07:002016-10-17T07:24:18.679-07:00Good-bye symlinksDart 1.20 is now available. <a href="https://www.dartlang.org/install">Get it now!</a><br /><br />Back in the Dart 1.19 release <a href="http://news.dartlang.org/2016/08/so-long-symlinks.html">we introduced support</a> for the <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">.package</span> file; our replacement for the /packages/ directory often filled with hundreds of symlinks. In 1.19 this support was opt-in via passing an option to <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">pub get</span>. Now that it has had time to mature, and based on favorable feedback, we have gone ahead and made it the default. If for some reason this causes issues, you can still get symlinks by using the <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">pub get --packages-dir</span> command; in such cases make sure to <a href="https://github.com/dart-lang/sdk/issues/new?title=%5Bpackage+directory+issue%5D">file an issue</a>.<br /><br />One common question we have received is how to handle resource loading in a world without packages symlinks. The <a href="http://news.dartlang.org/2016/08/so-long-symlinks.html">symlinks blog post</a> covers this in detail. In summary you can either resolve a Uri to a resource using the new <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><a href="https://api.dartlang.org/stable/dart-isolate/Isolate/resolvePackageUri.html">resolvePackageUri</a></span> API (e.g., <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">Uri actualURI =&nbsp;</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp; await Isolate.resolvePackageUri(Uri.parse("package:foo/bar.txt"))</span> ), or you can use the new <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><a href="https://pub.dartlang.org/packages/resource">package:resource</a></span> that provides a more abstract API.<br /><br />Finally, the VM has been updated to throw catchable Error objects when method compilation fails. This allows <a href="https://pub.dartlang.org/packages/test"><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">package:test</span></a>, for instance, to provide useful stack traces when running code with syntax errors.<br /><br />See the full changelog <a href="https://github.com/dart-lang/sdk/blob/master/CHANGELOG.md#1200">here</a>.<br /><br /><a href="https://www.dartlang.org/install">Download the latest release</a>, and <a href="https://www.dartlang.org/community">let us know</a> what you think!Anders Thorhauge Sandholmhttp://www.blogger.com/profile/02074725733613485890noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-17207633869790628092016-10-13T10:56:00.000-07:002016-10-13T10:56:09.688-07:00The new Google AdSense user interface: built with AngularDartAdSense is a free, simple way to earn money by placing ads on your website. The team just launched a completely new version of their app for publishers. Read all about it <a href="https://adsense.googleblog.com/2016/10/meet-new-adsense-user-interface.html">here</a>. We asked Daniel White, the tech lead for the project, some questions because the new UI happens to be built with Dart and Angular2.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-8iJGLHsOGsg/V__Fs3UR6hI/AAAAAAAAN9g/7rBI5M9mclsLfZG7IrUxRSFazU91bc1YwCLcB/s1600/AdSense_Material%2B%25281%2529.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://2.bp.blogspot.com/-8iJGLHsOGsg/V__Fs3UR6hI/AAAAAAAAN9g/7rBI5M9mclsLfZG7IrUxRSFazU91bc1YwCLcB/s640/AdSense_Material%2B%25281%2529.gif" width="640" height="401" /></a></div><br /><strong>AdSense launched way back in 2003. How long is it since the last big redesign?</strong><br />Last big redesign was called ‘AdSense 3’ and launched about 6 years ago. It was written in Google Web Toolkit (GWT) and the UI has evolved through several iterations - but this is the first ground-up redesign in 6 years. There are a number of long-standing UX issues that we’ve taken the opportunity to solve. A big shout-out to our UX team who’ve been 100% behind this project. We couldn’t have done it without them!<br /><br /><strong>How many software engineers worked on the project?</strong><br />Purely on the AdSense applications, we have a team of close to 100. Around 25% of them write Dart.<br /><br /><strong>How many lines of code?</strong><br />We have around 160K LOC of Dart.<br /><br /><strong>How long does it take to do a complete redesign like this?</strong><br />We’ve been following Dart for a long time and started to pilot it about 2.5 years ago. In the last 18 months we’ve shipped most major new features in Dart. For AdSense Material Design, we started UX work in December 2015 - coding started in February. So, 8 months.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-sqjrZZruwD0/V__HJRaQ9II/AAAAAAAAN9s/oN3U2EGgG7sfpbYakbtpcWxnyIjjbcLFwCLcB/s1600/adsense-old-vs-new.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; border:none"><img border="0" src="https://4.bp.blogspot.com/-sqjrZZruwD0/V__HJRaQ9II/AAAAAAAAN9s/oN3U2EGgG7sfpbYakbtpcWxnyIjjbcLFwCLcB/s640/adsense-old-vs-new.png" width="640" height="210" style="border: none; -webkit-box-shadow: 0px 0px 0px 0px rgba(0,0,0,0.75); -moz-box-shadow: 0px 0px 0px 0px rgba(0,0,0,0.75); box-shadow: 0px 0px 0px 0px rgba(0,0,0,0.75);"/></a></div><br /><strong>What’s the stack?</strong><br />Strong mode Dart, Angular 2&nbsp;— we just migrated all our codebase away from AngularDart1. Java servers. We use protocol buffers to communicate between the browser and our UI servers.<br /><br />We also have an older GWT app running on the same page and we use protocol buffers to communicate between the Dart and GWT codebases.<br /><br /><strong>Have you seen any productivity improvements?</strong><br />Compared to our old GWT workflows, we see much faster iteration. Compiling and starting the server is about 8X quicker&nbsp;than it used to be. Refreshing a page is about 6-7X quicker in dev mode. Tech leads that have shipped products have estimated a 2X improvement in overall project speed&nbsp;- from beginning implementation until launch.<br /><br /><strong>How about performance improvements?</strong><br />Loading the page requires about 50% less data&nbsp;(it’s around 900K-1000K smaller - this is mostly due to a new architecture, but moving to Dart let us redesign all that stuff). Using a cold cache, the time from initial request to working UI is about 45% less.<br /><br /><strong>Were the developers happy?</strong><br />Yes. The combination of Dart and Angular is working really well for us&nbsp;- we anticipate this to improve even more now that Angular’s Dart codebase can be tailored to the language (better error messages, optimizing code size).<br /><br />When we decided to push ahead with Dart, the response from tech leads within AdSense was very enthusiastic - to the point where the small pilot team was overwhelmed with new requirements to support!<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-wUY-Ti2-YSA/V__ErFpEmUI/AAAAAAAAN9Q/gTR0c57eV70AlgqUZYZComgPUU2XutszwCLcB/s1600/IMG_1356.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://2.bp.blogspot.com/-wUY-Ti2-YSA/V__ErFpEmUI/AAAAAAAAN9Q/gTR0c57eV70AlgqUZYZComgPUU2XutszwCLcB/s640/IMG_1356.jpg" width="640" height="427" /></a></div><br /><strong>What are the advantages and disadvantages of the new stack?</strong><br />The main advantage for us is having a top quality tech stack that we can share with other Google products - shared code and components can be developed for reuse by other teams. This gives us consistent UIs and massively reduces the amount of custom code we need to write.&nbsp;The benefits of that can now be shared with the outside world too — the Material Design UI components that have been worked on by hundreds of engineers&nbsp;will be gradually released to open source.<br /><br />The disadvantages have largely been around being on the cutting edge, particularly with Angular2. We need to keep up with breaking changes in Angular. Thankfully, Angular has mostly stabilized now and we’re looking forward to 2.0 final (to be launched on the Dart Developer Summit).<br /><br /><strong>Any surprises?</strong><br />What’s been very gratifying is that investing in improved developer productivity/workflows has had visible impact on the quality of the Material Design AdSense applications. Developers feel ‘in tune’ with the page because they can see the effects of code changes very quickly, but they also get the benefit of types/refactoring/tool support that come with a statically typed language.<br /><br /><strong>Alright, so now that you launched, what’s coming next?</strong><br />Our new tech stack is going to allow us to ship higher quality changes more quickly, which is what we plan to do as we launch more Material Design changes over the coming months and years.<br /><br /><strong>Thank you, Daniel!</strong><br />Thanks!Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-21399160453762189052016-10-11T01:18:00.000-07:002016-10-11T01:18:03.655-07:00What’s your favorite Dart feature?<div dir="ltr" style="line-height: 1.38; margin-bottom: 3pt; margin-top: 0pt;"><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/nuklZsXAXnlSwbHoVs5fetfNUxSaYkzUgy5MIUKGwy8UhRLKvbU9DguaA4OSgwFrAzyZdJZrlcM=w1920-h1200-rw-no" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="64" src="https://2.bp.blogspot.com/nuklZsXAXnlSwbHoVs5fetfNUxSaYkzUgy5MIUKGwy8UhRLKvbU9DguaA4OSgwFrAzyZdJZrlcM=w1920-h1200-rw-no" width="320" /></a></div>Earlier this year we had an ongoing thread where Googlers shared their favorite Dart feature—perhaps a less known one. We wanted to share these insights from some of our most engaged internal users more broadly. Hence this post.<br /><div class="separator" style="clear: both; text-align: center;"></div><br />The names have been changed to protect the innocent, but the contents should constitute some fine reading.<br /><br />Here we go:<br /><br /><hr /><br />What's your favorite "less known" (or undocumented) feature of Dart?<br />Any particular syntax trick or library function?<br /><br />Java has loads of these, tricks ranging from the double-paren<span style="font-family: inherit;">. init (</span><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">Map&lt;String,String&gt; {{ put("a", "1"); }};</span><span style="font-family: inherit;">) </span>to "sneaky throwing" ANY exception.<br />Anything similar in Dart?<br /><br />Cheers,<br />Agile Analyzer<br /><br /><hr /><br />As a Java developer, my opinion of both of those is: this is clever, but don't do it in real code under any circumstances.<br /><br />-Bug Basher<br /><br /><hr /><br />I'm not a fan of tricks, and from what I've seen so far Dart needs very few. There are some features of the language that I feel are underutilized or are very new. Here are a few:<br /><br />- <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">Null</span>&nbsp;is a type, so if you have a Future and you want to document that it doesn't return anything useful, make it a <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">Future&lt;Null&gt;</span><br />- You can throw arbitrary objects in Dart without losing stack traces: <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">throw "This is an error"</span><br />- <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">const</span> can be a local variable and it will still be allocated only once (no need to hoist it into a static field or top-level constant)<br />- You can create custom matchers and use them in your tests (<a href="https://github.com/flutter/flutter/blob/32527017531d0a9efef14f890d0502f7bf614e33/packages/flutter_test/test/widget_tester_test.dart#L12">example</a>)<br />- There exists <a href="https://www.dartdocs.org/documentation/meta/1.0.1/meta/meta-library.html">package:meta</a> that the analyzer understands, and which has @protected, @required (for required named parameters), and others<br />- You can <i>implement</i> classes as every class also exports its interface.<br /><br />-Clever Compiler<br /><br /><hr /><br />My favorite lesser-known feature is pretty simple: <b>you can define stuff outside of classes</b>.<br /><br />I see a lot of users coming to Dart from Java or C# and they are in the habit of stuffing every variable or function inside a class either because they think you have to—which you do in those languages—or out of a belief that it makes their code better in some vague "OOP paradigm is best paradigm" sort of way.<br /><br />Object-orientation is a fantastic paradigm for expressing some kinds of code. It works really well when you have interesting state and interesting operations that are deeply tied to that state. It's also great when you want polymorphism based on kinds of objects.<br /><br />But a lot of times, you're just trying to express some vanilla data or some imperative behavior. For those, classes don't provide any value. If you just want to define the value of π somewhere, you don't need a class named, like, I dunno "MathematicalConstants" to put it in. You can just do:<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">const pi = 3.1; // Eh, close enough.</span><br /><br />Likewise, sometimes all you need is a procedure, not a method. Say you create and file and write some string to it. You could make a "FileWriter" class or something, but why bother? You can just do:<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">void writeFile(String path, String contents) { ... }</span><br /><br />You might be thinking that you need to put definitions inside classes to avoid name collisions and to "namespace" things, but you don't need to do that in Dart. Libraries in Dart are the unit of namespacing and modularity. With show, hide, and import prefixes, libraries are much better at expressing namespaces and dealing with name collisions.<br /><br />If you made it this far, I will note one feature that really is rarely used. Did you know that you can define <i>getters</i> and <i>setters</i> at the top level too? You can define something that looks like a top-level variable but is actually doing computation.<br /><br />Cheers!<br />--Dart Dogfood<br /><br /><hr /><br />+1 for simple short-hands. &nbsp;When a language is young, there's a tendency to use it like that-other-thing-you-know. &nbsp;These conversations are a really good thing.<br /><br />Instead of writing:<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">if (foo == null) {</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; foo = 'bar';</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">}</span><br /><br />Just do: &nbsp;<span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">foo ??= 'bar';</span><br /><br />The "cognitive load" (ahem!) is much lower. &nbsp;It's similar to Ruby's <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">foo ||= 'bar'</span> but better, because it strictly applies to nulls (vs. <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">nil</span> &amp; <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">false</span>).<br /><br />-Eager Execution<br /><br /><hr /><br />I like <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><b>??=</b></span> for lazy-initialized fields<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp;T _foo;</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp;T get foo =&gt; _foo ??= _computeValue();</span><br /><br />--Failed Function<br /><br /><hr /><br />I wouldn't describe these as "favorite" features, but they do seem to be lesser known:<br /><br /><ul><li>null-aware operators, as a number of people have mentioned: <br /><a href="http://news.dartlang.org/2015/08/dart-112-released-with-null-aware.html">http://news.dartlang.org/2015/08/dart-112-released-with-null-aware.html</a></li><li>very extensive matcher library:<br /><a href="https://www.dartdocs.org/documentation/test/0.12.5+1/test/test-library.html">https://www.dartdocs.org/documentation/test/0.12.5+1/test/test-library.html</a></li><ul><li>and as “dd” pointed out, you can even write custom matchers</li></ul></ul><br />+1 to avoiding things that are "clever" but hard to read.<br /><br />--Great Googler<br /><br /><hr /><br />I don't see generators used all that much and there are some places where they really help.<br /><a href="https://www.dartlang.org/articles/language/beyond-async#generators">https://www.dartlang.org/articles/language/beyond-async#generators</a><br /><br />For some use cases a generator is going to be more readable than the alternatives, in others it's very tempting to write a 'clever' generator.<br /><br />--Heated Hotspot<br /><br /><hr /><br />One of my favourite features is that the analyzer will tell you if you use a switch statement with an enum and don't list all the enum values.<br /><br />This means that if you've been careful always to use switches when using enums (rather than if/else chains), you can just add the new value to the switch, run the analyzer, and it'll tell you all the places you need to update.<br /><br />--Injected Iterator<br /><br /><hr /><br />Thanks everybody!!!<br /><br />Lots of stuff to try out and/or read about! I've been actually thinking that something like the <a href="https://pub.dartlang.org/packages/meta">meta library</a> would be nice (and hey, it's already live!)<br /><br />Awesome thread :)<br /><br />--Agile Analyzer<br /><br /><hr /><br />My favourite Dart things are foremost the ones I created ;) ... immutable collections, immutable value types, proper enums, and object oriented serialization:<br /><br />- <a href="https://github.com/google/built_value.dart/blob/master/libraries_for_object_oriented_dart.md">https://github.com/google/built_value.dart/blob/master/libraries_for_object_oriented_dart.md</a><br /><br />And a few I didn't:<br /><br />&nbsp;- The ".." operator is a gift for anyone who likes fluent APIs.<br />&nbsp;- source_gen (and now the "build" package) really hits the sweet spot for code generation.<br /><br />Cheers<br />--JIT Juggler<br /><br /><hr /><br />Someone I was talking to mentioned another of my favourites - using interpolation instead of toString.<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp; x.toString()</span><br /><br />can usually be replaced by<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp; '$x' &nbsp;</span><span style="font-family: inherit;">or</span><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"> &nbsp;'${x}'</span><br /><br />It is shorter, looks like it should be a string, and guarantees the result is a String (toString() may perversely return null, even in checked or strong mode).<br /><br />--Failed Function<br /><br /><hr /><br />Kinda late for the party ;)<br /><br />I just started to use Dart for two months, still so much to learn. Other than null-aware operators that is already mentioned, I also find double-dot operator very handy for method cascade.<br /><br />Instead of doing:<br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">o = new MyObject();</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">o.set(x);</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">o.set(y);</span><br /><br />Now we can:<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">o = new MyObject()</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp;..set(x)</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp;..set(y);</span><br /><br />--Klever Kompiler<br /><br /><hr /><br />Here's some I like:<br /><br />You can use 'expand' to concat lists:<br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">[[1,2,3], [4,5,6], [], [7,8,9]].expand((x) =&gt; x) // returns [1,2,3,4,5,6,7,8,9]</span><br /><br />I don't think this pattern is used often enough, abstract classes which have a forwarding factory constructor to the real implementation:<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">abstract class Foo {</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; factory Foo() = _Foo;</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; // ... Foo methods ...</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">}</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;"><br /></span> <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">class _Foo implements Foo {</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; // ... implementation &nbsp;...</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">}</span><br /><br />This lets you put all your documentation on 'Foo' and let people call 'new Foo()' while the private class '_Foo' actually has all the implementation details that nobody cares about.<br /><br />--Linked List<br /><br /><hr /><br />This may not come up that often, but I love the <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">*</span> operator on Strings (thanks Failed Function!):<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">_padRight(String message, int columns) {</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp;var padding &nbsp;= " " * (columns - message.length);</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp;return '$padding$message';</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">}</span><br /><br />--Main Method<br /><br /><hr /><br />I wouldn't call it a feature, but lot of people don't seem to realize (is it something originating from Java?) you can pass any function/method tearoff as an argument, not necessarily an anonymous literal, ie:<br /><br />Instead of <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">xs.map((x) =&gt; foo(x))</span> do <span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">xs.map(foo)</span>.<br /><br />--Non Nullable<br /><br /><hr /><br />I really like functional methods in combination with tear-offs:<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">int bestScore = [1, 2, 5, 1].reduce(max);</span><br /><br />And generators.<br /><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">/// Merge [a] and [b] until [a] is fully consumed. Then add 42.</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">Iterable&lt;int&gt; combine(Iterable&lt;int&gt; a, Iterable&lt;int&gt; b) sync* {</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; var aIterator = a.iterator;</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; var bIterator = b.iterator;</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; while (aIterator.moveNext()) {</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp; yield aIterator.current;</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp; if (bIterator.moveNext()) {</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp; &nbsp; yield bIterator.current;</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; &nbsp; }</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; }</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">&nbsp; yield 42;</span><br /><span style="font-family: &quot;courier new&quot; , &quot;courier&quot; , monospace;">}</span><br /><br /><br />Seriously, though, this whole thread should be a blogpost on <a href="http://news.dartlang.org/">news.dartlang.org</a>.<br /><br />--Optimized Object<br /><br /><hr /><br />The only question remaining now is:<br /><br /><div style="text-align: center;">What is <i><b>your</b></i> favorite Dart feature?</div><br /><br /><br /><br /></div>Anders Thorhauge Sandholmhttp://www.blogger.com/profile/02074725733613485890noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-55650878002592259062016-09-20T11:48:00.000-07:002016-09-20T11:51:15.440-07:00Dart Developer Summit announcements: AngularDart 2.0 and more<div class="separator" style="clear: both; text-align: center;"><a href="https://events.dartlang.org/2016/summit/" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://2.bp.blogspot.com/-ZM4lbMFXWd4/V-GDxEV9hLI/AAAAAAAAN0o/Cv-p3enCk_Id3N97zkP5p6OBxda5whHGACLcB/s320/Screen%2BShot%2B2016-09-16%2Bat%2B12.12.10.png" width="320" height="219" /></a></div>The Dart Developer Summit is only 5 weeks ahead, and we’re excited about its agenda: 17 talks, many demos, 25 speakers, plus a lightning talks session and a panel discussion. Expect the full program soon on the site, but here’s a teaser:<br /><br /><ul><li>Major improvements to the type system</li><li>Much better interoperability with JavaScript</li><li>Improved developer workflow</li><li>AngularDart 2.0</li><li>And much more</li></ul><br />We will share more details as we approach the summit. Because the TypeScript flavor of Angular <a href="http://angularjs.blogspot.com/2016/09/angular2-final.html">just released</a>&nbsp;version 2.0 last week, we think it’s a good opportunity to share more details about AngularDart 2.0.<br /><br />Besides the changes you’d expect, such as faster execution and reduced size (on which we’re already making <a href="https://github.com/dart-lang/angular2/blob/master/CHANGELOG.md#200-beta21">a lot of progress</a>), we will also have a better template compiler&nbsp;and some nice surprises for you.<br /><br />The beta releases of AngularDart have been in production use at Google since January, in MLOC-sized apps. This&nbsp;has helped us to see what works well for large apps, and to improve the APIs accordingly.<br /><br />We hope you’ll&nbsp;join us in person or online at the <a href="https://events.dartlang.org/2016/summit/">Dart Developer Summit in Munich</a>. To learn about AngularDart, visit <a href="http://angulardart.org/">angulardart.org</a>.<br />Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-20766314833665956042016-09-06T16:47:00.000-07:002016-09-06T17:03:45.433-07:00Configuring Static Analysis using an Analysis Options FileStatic analysis allows you to find problems before executing a single line of code. It’s a powerful tool used to prevent bugs and ensure that code conforms to style guidelines. With the help of the analyzer, you can find simple typos. For example, an accidental semicolon made its way into an <span style="font-family: Courier New, Courier, monospace;">if</span> statement:<br /><br /><a href="http://4.bp.blogspot.com/-j9prmpcXZgc/V89RifLdqGI/AAAAAAAAvFY/ze_YEDlWIhwuu_cQ3c8G8ZHtiB9ilHkjACK4B/s1600/Screen%2BShot%2B2016-09-06%2Bat%2B14.31.39.png"><img border="0" src="https://4.bp.blogspot.com/-j9prmpcXZgc/V89RifLdqGI/AAAAAAAAvFY/ze_YEDlWIhwuu_cQ3c8G8ZHtiB9ilHkjACK4B/s400/Screen%2BShot%2B2016-09-06%2Bat%2B14.31.39.png" /></a><br /><br />The analyzer can also help you find more subtle problems. For example, perhaps you've forgotten to close a sink instance:<br /><br /><a href="http://2.bp.blogspot.com/-nKUN5fKdL4k/V89SOhkixMI/AAAAAAAAvFo/AZFNH71k9roF2nT9ljkL9jcVEDeozxn2ACK4B/s1600/Screen%2BShot%2B2016-09-06%2Bat%2B14.47.38.png"><img border="0" src="https://2.bp.blogspot.com/-nKUN5fKdL4k/V89SOhkixMI/AAAAAAAAvFo/AZFNH71k9roF2nT9ljkL9jcVEDeozxn2ACK4B/s320/Screen%2BShot%2B2016-09-06%2Bat%2B14.47.38.png" /></a><br /><br />In the Dart ecosystem, the Dart Analysis Server and other tools use the <a href="https://pub.dartlang.org/packages/analyzer">analyzer package</a> to perform static analysis. You can configure the analyzer using an analysis options file.<br /><br />For more information, see our new page, <a href="https://www.dartlang.org/guides/language/analysis-options">Customize Static Analysis</a>.Shams Zakhourhttps://plus.google.com/116669394590585398774noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-28839652731733396842016-08-26T16:11:00.000-07:002016-09-21T10:23:30.574-07:00Dart 1.19: Improved developer experiences<div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-k4t6VQornXs/V8DLh_aLO2I/AAAAAAAANeg/GIPnbSe3jC8ceSr04hFO8l2rAjqugY46wCLcB/s1600/dart-1.19.png" imageanchor="1" style="border: none; clear: right; float: right; margin-bottom: 1em; margin-left: 2em;"><img border="0" height="64" src="https://4.bp.blogspot.com/-k4t6VQornXs/V8DLh_aLO2I/AAAAAAAANeg/GIPnbSe3jC8ceSr04hFO8l2rAjqugY46wCLcB/s200/dart-1.19.png" style="border: none; box-shadow: none;" width="200" /></a></div>Dart 1.19 is now available. <a href="https://www.dartlang.org/install">Get it now!</a><br /><br />We closely collaborate with the <a href="https://flutter.io/">Flutter</a> team on providing the best developer experience for Dart for Mobile. This includes language changes that optimize the Flutter development experience. Dart code for Flutter apps commonly have long argument lists. Before 1.19, a trailing comma was not allowed after the last argument. This made it really tedious when removing the last argument, or when reordering the arguments. With 1.19 we introduce support for an optional trailing comma after the last argument of a call and the last parameter of a function declaration. This makes code editing much easier:<br /><br /><a href="https://2.bp.blogspot.com/-kVBJlnXby54/V8DJqaZsvwI/AAAAAAAANeU/suPDhaZcdsEvN1DuYy8669JJ-W6x1zX1wCLcB/s1600/ReorderCode.gif" imageanchor="1"><img border="0" src="https://2.bp.blogspot.com/-kVBJlnXby54/V8DJqaZsvwI/AAAAAAAANeU/suPDhaZcdsEvN1DuYy8669JJ-W6x1zX1wCLcB/s1600/ReorderCode.gif" /></a><br /><br />If you've struggled with package directory symlinks, you're in luck. You can now opt-out of creating a package directory and the associated symlinks scattered around your project directories. The flag to provide to pub get and pub upgrade is <code>--no-packages-dir</code>. We've posted a <a href="http://news.dartlang.org/2016/08/so-long-symlinks.html">detailed writeup</a> of the changes if you'd like more information. Please test your code with this flag. We intend to make <code>--no-packages-dir</code> the default behavior in an upcoming release.<br /><br />See full changelog <a href="https://github.com/dart-lang/sdk/blob/master/CHANGELOG.md#1190">here</a>.<br /><br /><a href="https://www.dartlang.org/install">Download the latest release</a>, and <a href="https://www.dartlang.org/community">let us know</a> what you think!Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-65987350806140907962016-08-26T15:56:00.000-07:002016-09-13T11:27:24.762-07:00So Long, Symlinks!Long ago, back in the dawn of time, when nary a Dart file was to be found outside of the <a href="https://github.com/dart-lang/sdk">SDK repository</a>, imports in Dart only supported file paths. As the language got older and an ecosystem began to grow around it, it quickly became clear that paths weren’t enough: Dart needed a way to import libraries that didn’t care about the location of the file doing the importing. The language team talked to the VM team and they came up with a solution. In addition to <code>file:</code> URIs, Dart would support a new <code>package:</code> scheme by looking for packages in a <code>packages/</code> directory next to the entrypoint, wherever that happened to be.<br /><br />This worked pretty well—well enough to form the foundation for the pub package manager, written by <a href="https://github.com/munificent">Bob</a> and myself. But it also had flaws. A <em>lot</em> of symlinks had to be generated all over every package—the <code>test</code> package currently contains about four hundred. Not only was this messy, many tools ended up following the symlinks and corrupting the package cache. So the team came together again and came up with the idea of a <a href="https://github.com/dart-lang/dart_enhancement_proposals/blob/master/Accepted/0005%20-%20Package%20Specification/DEP-pkgspec.md">package configuration file</a> that lists available packages as well as the concrete URIs where they can be found.<br /><br />Support for package config was quickly added to all Dart implementations. In fact, pub has been generating them since Dart 1.12. The only task remaining was to gracefully turn off pub’s support for generating the <code>packages/</code> directory and all the symlinks that come with it… but that turned out to be easier said than done.<br /><br />The thing is, for all its flaws, the <code>packages/</code> directory was pretty easy to work with from Dart code. You just had to do some path manipulation with <a href="https://api.dartlang.org/stable/1.18.1/dart-io/Platform/script.html"><code>Platform.script</code></a> to figure out where the <code>packages/</code> directory was, and from there you could do whatever you wanted. It wasn’t clean, but it worked most of the time, and there was no way to do the same stuff with <code>.packages</code>.<br /><br />Once again conversation ensued. APIs were proposed, rejected, redesigned, tweaked, implemented, rolled back, iterated on, landed, stabilized<a class="footnote" href="https://draft.blogger.com/blogger.g?blogID=1636601191077561071#fn:1" id="fnref:1" title="See footnote">1</a>, and verified. It took seven releases to get everything just right, but we did it, and we’re ready for you to try it out. And I’m here to tell you how.<br /><br /><h2 id="disabling-the-packages-directory">Disabling The Packages Directory</h2><br />The first step on your journey to package enlightenment is to abandon your attachment to worldly directories. Relinquish your need for the comfort of familiarity by passing <code>--no-package-dir</code><a class="footnote" href="https://draft.blogger.com/blogger.g?blogID=1636601191077561071#fn:2" id="fnref:2" title="See footnote">2</a> to <code>pub get</code> (or <code>upgrade</code> or <code>downgrade</code>). Pub won’t generate a <code>packages/</code> directory, nor of course will it symlink to the directory that it doesn’t generate. If you already had a <code>packages/</code> directory, pub will get rid of it as well as any symlinks pointing its way.<br /><br />For most packages and applications, this is all you’ll need to do! The latest versions of core Dart tools like pub and <a href="https://pub.dartlang.org/packages/test"><code>test</code></a> fully support running with a package config. As long as your code isn’t manually dealing with packages, you’re good to go. And if it is, keep reading!<br /><br /><h2 id="core-package-apis">Core Package APIs</h2><br />The core libraries have a few primitive APIs for providing information about package resolution. They form the foundation of more advanced APIs implemented in packages, but they’re also straightforward enough to use on their own. They cover many of the most common use-cases for dealing with packages. It’s important to note, though, that they only work in the Dart VM; the JavaScript compilers only deal with packages at compile-time, so they have no way of reporting anything about them at runtime.<br /><br />The most broadly-applicable library package API is <a href="https://api.dartlang.org/stable/latest/dart-isolate/Isolate/resolvePackageUri.html"><code>Isolate.resolvePackageUri()</code></a>. It converts a <code>package:</code> URI into a <code>file:</code><a class="footnote" href="https://draft.blogger.com/blogger.g?blogID=1636601191077561071#fn:3" id="fnref:3" title="See footnote">3</a> URL that can be <a href="https://www.dartdocs.org/documentation/path/latest/path/fromUri.html">easily converted to a path</a>. This is the easiest way to find resources in your package, or even public resources in your dependencies.<br /><br />It’s important to note that this API is asynchronous, though: it returns a <code>Future&lt;Uri&gt;</code> rather than just a <code>Uri</code>. This is because the VM loads package information lazily, and the load process is asynchronous. If you have any <code>package:</code> imports in your code, the information will already be loaded, but it’s not safe to assume that—even code that uses lots of different packages may be run from a snapshot every now and then.<br /><br />The other important core APIs tell you where the package resolution comes from. <a href="https://api.dartlang.org/stable/latest/dart-isolate/Isolate/packageConfig.html"><code>Isolate.packageConfig</code></a> returns the URL of the package config file used for the current isolate, and <code>null</code> if a package root is being used. Its twin, <a href="https://api.dartlang.org/stable/latest/dart-isolate/Isolate/packageRoot.html"><code>Isolate.packageRoot</code></a>, returns the URL of the current isolate’s package root, and <code>null</code> if a package config is being used. These getters are useful for forwarding the current resolution scheme—for example, if you want to start a Dart process that uses the same resolution as the current isolate, you can use these to figure that out.<br /><br />I should probably also mention the <a href="https://api.dartlang.org/stable/latest/dart-io/Platform/packageConfig.html"><code>Platform.packageConfig</code></a> and <a href="https://api.dartlang.org/stable/latest/dart-io/Platform/packageRoot.html"><code>Platform.packageRoot</code></a> getters as well, but <em>I do not recommend using them</em>. They return exactly the text passed on the command-line for the <code>--packages</code> or <code>--package-root</code> flag, respectively. This means they’re unreliable: if the package resolution information was auto-detected, they’ll return <code>null</code>. If the current Isolate uses a different resolution scheme than the main isolate, they could return something completely irrelevant. Avoid them.<br /><br /><h2 id="the-packageresolver-package">The <code>package_resolver</code> Package</h2><br />If you want to go beyond the basics in your package code, <a href="https://pub.dartlang.org/packages/package_resolver"><code>package_resolver</code></a> is the package for you. It provides classes that encapsulate <em>strategies</em> for package resolution—using a package config, using a root, or using nothing at all. Where code used to just pass around a <code>packageRoot</code> string, it can now pass a <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver-class.html"><code>PackageResolver</code></a> that says how to resolve URIs.<br /><br />You can construct a <code>PackageResolver</code> by passing a package config map to <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/PackageResolver.config.html"><code>new PackageResolver.config()</code></a>, or by passing a package root to <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/PackageResolver.root.html"><code>new PackageResolver.root()</code></a>. If all you have is the URI for a package config, you can also use <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/loadConfig.html"><code>PackageResolver.loadConfig()</code></a>. But most of the time, all you need is information about the current isolate’s package resolution, which you can get from the <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/current.html"><code>PackageResolver.current</code></a> getter.<br /><br />The resolver supports more or less the same APIs that the Isolate does: <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/resolveUri.html"><code>resolveUri()</code></a> is equivalent to <code>Isolate.resolvePackageUri()</code>, <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/packageConfigUri.html"><code>packageConfigUri</code></a> to <code>Isolate.packageUri</code>, and <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/packageRoot.html"><code>packageRoot</code></a> to <code>Isolate.packageRoot</code>. But it builds other useful methods on top of these as well.<br />The <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/packagePath.html"><code>packagePath()</code></a> method returns the root of a package on the local filesystem. It assumes that you’re using pub, since it needs to look above packages’ <code>lib/</code> directories, but this works in practice for essentially all Dart code.<br /><br />The <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/packageUriFor.html"><code>packageUriFor()</code></a> method is the reverse of <code>Isolate.resolvePackageUri()</code>: it converts a <code>file:</code> URL into a <code>package:</code> URI that refers to the same file, if such a URI exists. This is useful for reporting nice-looking messages; it’s much easier to read a short <code>package:</code> URI than a long absolute path.<br /><br />The <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/processArgument.html"><code>processArgument</code></a> getter is useful when running Dart processes or compiling Dart to JS. It returns an argument that can be passed directly to the <code>dart</code>, <code>dart2js</code>, or <code>dartdevc</code> executables that will cause them to use the resolver’s resolution strategy. If you passed using a custom package config map, it’ll even manufacture a <code>data:</code> URI for you<a class="footnote" href="https://draft.blogger.com/blogger.g?blogID=1636601191077561071#fn:4" id="fnref:4" title="See footnote">4</a>.<br /><br />It even exposes the package config map directly through the <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/packageConfigMap.html"><code>packageConfigMap</code></a> getter. Note that since the isolate API doesn’t <a href="https://github.com/dart-lang/sdk/issues/25507">yet</a> provide this information directly, this may require re-loading it from disk.<br /><br /><h3 id="but-i-want-it-synchronous">But I Want It Synchronous!</h3><br />All the <code>PackageResolver</code> APIs are asynchronous because they might be implemented using the asynchronous Isolate APIs. But asynchrony can be annoying to work with, and sometimes it’s not necessary. That’s what the <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html"><code>SyncPackageResolver</code></a> class is for. It exposes pretty much the same API as <code>PackageResolver</code>, but with no futures to be found.<br /><br />The catch is that if you want to get a <code>SyncPackageResolver</code>, all the information—the package config map or the package root URI—needs to be available up-front. So <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver/current.html"><code>SyncPackageResolver.current</code></a> and <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver/loadConfig.html"><code>SyncPackageResolver.loadConfig()</code></a> both return <code>Future&lt;SyncPackageResolver&gt;</code>, since they have to wait for Isolate API futures and/or load information from disk.<br /><br />You can convert back and forth between synchronous and asynchronous package resolvers easily using the <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/PackageResolver/asSync.html"><code>asSync</code></a> and <a href="https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver/asAsync.html"><code>asAsync</code></a> APIs. This makes it possible for packages to take whichever one they work best with without causing pain for their users. For example, <a href="https://www.dartdocs.org/documentation/source_map_stack_trace/latest/source_map_stack_trace/mapStackTrace.html"><code>source_map_stack_trace</code></a> takes a <code>SyncPackageResolver</code> so it can work synchronously, but <a href="https://www.dartdocs.org/documentation/shelf_packages_handler/latest/shelf_packages_handler/packagesHandler.html"><code>shelf_packages_handler</code></a> takes a <code>PackageResolver</code> since serving handling requests is already inherently async.<br /><br /><h3 id="why-bother-with-the-package-root">Why Bother With The Package Root?</h3>The <code>package_resolver</code> package goes to pains to work well with both package configs and package roots, and to make it easy for users to support both. This raises a question: if pub is moving away from generating a <code>packages/</code> directory, what’s the point of supporting it?<br /><br />First of all, there’ll be a transition period where both modes will be fairly common. Pub still generates the <code>packages/</code> directory by default for now, and the language implementations prefer it if it exists. A smooth transition relies on code’s ability to be used in both old and new settings.<br />But even in the future when <code>packages/</code> files aren’t generated by default, support for package roots will be sticking around, and it can still be useful. It may not be the best way to run code manually, but a lot of code isn’t run manually—Pub’s transformer support, for example, loads isolates over HTTP, where it serves virtual <code>packages/</code> directories.<br /><br />In addition to supporting current tools, we want leave the door open for future tools to innovate as-yet-undreamed-of ways to handle Dart code. So we choose flexibility and continue to support package roots.<br /><br /><h2 id="on-into-the-future">On Into The Future</h2>Once there’s been a release or two with the <code>--no-package-dir</code> flag and users have a chance to make sure their packages work with only a package config, we’ll disable the flag by default. You’ll need to pass <code>--packages-dir</code> explicitly if you want it generated. A while after that, we’ll hide the flag and stop officially supporting it. We may get rid of it entirely one day, but there’s no hurry—it’s not that hard to support.<br /><br />So go forth and update your packages! Use the core library APIs and the <code>package_resolver</code> package, or one of the helpful packages I didn’t have a chance to get to: <a href="https://pub.dartlang.org/packages/resource"><code>resource</code></a> provides an abstraction for loading resources, and <a href="https://pub.dartlang.org/packages/shelf_packages_handler"><code>shelf_packages_handler</code></a> makes it easy for a Shelf server to support a package root. Or write your own! The underlying tools are powerful, and I’m excited to see what you can do with them.<br /><div class="footnotes"><hr /><ol><li id="fn:1">Well, <em>mostly</em> stabilized. There are still a few corners of the API that are still in the process of being thoroughly tested. Bear with us if you run into them, and maybe wait another release cycle before you depend <em>too</em> heavily on running without the <code>packages/</code> directory. <a class="reversefootnote" href="https://draft.blogger.com/blogger.g?blogID=1636601191077561071#fnref:1" title="Return to article">↩</a></li><li id="fn:2">This flag is new in 1.19, but some readers may notice its similarity to the undocumented <code>--no-package-symlinks</code> that pub used to support. <code>--no-package-symlinks</code> was added ages ago to let the Dart analyzer team experiment with their package config support, and we decided to tweak it a bit when making it public. <a class="reversefootnote" href="https://draft.blogger.com/blogger.g?blogID=1636601191077561071#fnref:2" title="Return to article">↩</a></li><li id="fn:3">Since the Dart VM supports loading packages over HTTP, it’s theoretically possible for it to return an <code>http:</code> URL. This doesn’t happen that often in practice, but it is a possibility—for example, the <code>test</code> runner can load test suites over HTTP from a <code>pub serve</code> instance. <a class="reversefootnote" href="https://draft.blogger.com/blogger.g?blogID=1636601191077561071#fnref:3" title="Return to article">↩</a></li><li id="fn:4">Note that there are usually limits on how long command-line arguments can be, so this may not work if the package config is too big. <a class="reversefootnote" href="https://draft.blogger.com/blogger.g?blogID=1636601191077561071#fnref:4" title="Return to article">↩</a></li></ol></div>Natalie Weizenbaumhttp://www.blogger.com/profile/17561686962317321958noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-80716993983451328672016-07-28T10:41:00.000-07:002016-07-28T10:41:01.686-07:00Dart 1.18: Laying foundationsDart 1.18 is now available. <a href="https://www.dartlang.org/install">Go get it!</a><br /><br />The team has been focused on implementation details over the last six weeks. The API changes to the SDK are very light – see the <a href="https://github.com/dart-lang/sdk/blob/master/CHANGELOG.md">CHANGELOG</a> – but we have been working hard laying the foundation for a number of important projects.<br /><br /><ul><li>Improve the development and runtime experience for&nbsp;<a href="https://flutter.io/">Flutter</a>.</li><li>Improve the speed and stability of Dart Analyzer, especially as it relates to <a href="https://github.com/dart-lang/dev_compiler">dev_compiler</a>.</li><li>Work to finalize two language tweaks</li><ul><li>Initializing formals: <a href="https://github.com/dart-lang/sdk/issues/26655">https://github.com/dart-lang/sdk/issues/26655</a></li><li>Allow trailing commas: <a href="https://github.com/dart-lang/sdk/issues/26644">https://github.com/dart-lang/sdk/issues/26644</a></li></ul></ul><br /><a href="https://www.dartlang.org/install">Download</a> the latest release. <a href="https://www.dartlang.org/community">Let us know</a> what you think!Kevin Moorehttp://www.blogger.com/profile/08411979841477351623noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-47690430617175057262016-07-20T10:58:00.000-07:002016-12-07T18:47:57.824-08:00AngularDart is going all Dart<div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-eUhSp_RC_Sc/V4Z3MHG3JEI/AAAAAAAANXk/S9QMhaKabhg8z6JqjkdGijosXWmf3LqdgCLcB/s1600/angulardart-logo.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://2.bp.blogspot.com/-eUhSp_RC_Sc/V4Z3MHG3JEI/AAAAAAAANXk/S9QMhaKabhg8z6JqjkdGijosXWmf3LqdgCLcB/s1600/angulardart-logo.png" /></a></div>Until now, the multiple language flavors of Angular 2 were written as TypeScript source, and then automatically compiled to both JavaScript and Dart. We're happy to announce that we’re splitting the Angular 2 codebase into two flavors – a Dart version and a TypeScript/JavaScript version –&nbsp;and creating a dedicated <a href="https://webdev.dartlang.org/angular">AngularDart</a> team. <br /><br />This is amazing news for Dart developers because:<br /><br /><ul><li>The framework will feel more like idiomatic Dart.</li><li>It will make use of Dart features that couldn't work with the TypeScript flavor. </li><li>It will be faster.</li></ul><br />This is equally great news for our TypeScript and JavaScript developers, by the way. Cleaner API, performance gains, easier contributions. <a href="http://angularjs.blogspot.com/2016/07/a-dedicated-team-for-angulardart.html">Read more</a> on the Angular blog.<br /><br />Angular 2 for Dart is used by many teams at Google. <a href="http://news.dartlang.org/2016/03/the-new-adwords-ui-uses-dart-we-asked.html">Most famously</a> by the AdWords team, but many other Google teams build large, mobile-friendly web apps. Some of the top requests from these teams were: make the API feel like Dart, provide a faster edit-refresh cycle, and improve application performance.<br /><br />That’s exactly what we aim to do. We believe we can significantly improve both the performance and usability of AngularDart. For example, in the 2 weeks since we started work on the purely Dart version, we were already able to unleash <a href="https://github.com/dart-lang/dev_compiler/blob/master/STRONG_MODE.md">strong mode</a> on the code and were able to significantly improve the code quality (fixed 1000+ warnings).<br /><br /><h3>One more thing</h3><br />We're also happy to announce plans to release our <strong>library of Material Design components for Angular 2 Dart</strong>. These components are built purely in Dart, and they’re used in production Google apps. Watch <a href="http://news.dartlang.org/">news.dartlang.org</a> for updates.<br /><br />Here’s just one of the many Angular 2 Dart components we plan to release:<br /><br /><a href="https://1.bp.blogspot.com/-WAVRnMD6LZ0/V4Z3pcz2b5I/AAAAAAAANXs/I2iKy2cgwmo84LnCZMZU8PmBqdAQJSR4QCKgB/s1600/angulardart-material-component-preview.gif" imageanchor="1"><img border="0" src="https://1.bp.blogspot.com/-WAVRnMD6LZ0/V4Z3pcz2b5I/AAAAAAAANXs/I2iKy2cgwmo84LnCZMZU8PmBqdAQJSR4QCKgB/s1600/angulardart-material-component-preview.gif" /></a><br /><br />Dart was designed "batteries included" – it’s not just a programming language, but also a set of <a href="https://www.dartlang.org/docs/dart-up-and-running/ch03.html">stable libraries</a>, <a href="https://www.dartlang.org/tools/">solid tools</a>, a great framework — and soon, a repository of battle-tested UI widgets.<br /><br />The components aren’t ready to be publicly released yet, but if you were thinking about learning Dart, now is a good time to <a href="https://webdev.dartlang.org/guides/get-started">start</a>. By the time you’re ready to build production apps, you’ll have the building blocks at your disposal.<br /><br /><h3>Dig into AngularDart</h3><br /><code>angular2 2.0.0-beta.18</code> is now available on the <a href="https://pub.dartlang.org/packages/angular2">pub site</a>. You can look at the source, file issues and create pull requests at <a href="https://github.com/dart-lang/angular2">dart-lang/angular2</a>. If you already use AngularDart in a project, you can use <code>pub upgrade</code> now to get the latest version. Please join the <a href="https://gitter.im/dart-lang/angular2">AngularDart gitter</a> to ask general questions.Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-90412085563558029382016-07-13T14:16:00.001-07:002016-07-13T14:16:03.961-07:00Changes at dartlang.org<a href="http://4.bp.blogspot.com/-xlhEs3ibgps/V4aupBWztwI/AAAAAAAAD2k/5K5ad-aHdYUnfXR86zL6bkfNJg0fLQ3lQCK4B/s1600/Screen%2BShot%2B2016-07-13%2Bat%2B2.11.43%2BPM.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="164" src="https://4.bp.blogspot.com/-xlhEs3ibgps/V4aupBWztwI/AAAAAAAAD2k/5K5ad-aHdYUnfXR86zL6bkfNJg0fLQ3lQCK4B/s320/Screen%2BShot%2B2016-07-13%2Bat%2B2.11.43%2BPM.png" width="320" /></a><br />Today we simplified dartlang.org, making it reflect the current state of the project a little bit better.<br /><br />We have <a href="https://www.dartlang.org/">www.dartlang.org</a> for the fundamental Dart technologies—the language itself and the core libraries. And then we have separate websites for the different targets:<br /><ul><li><a href="https://webdev.dartlang.org/">webdev.dartlang.org</a> for web apps</li><li><a href="https://flutter.io/">Flutter</a> for iOS &amp; Android native apps</li><li><a href="https://dartino.org/">Dartino</a> for IoT</li><li><a href="https://www.dartlang.org/tutorials/dart-vm/get-started">Dart VM</a> for command-line apps and servers</li></ul>Some other changes we made:<br /><ul><li>Feature the pages that people visit most often.</li><li>Show the core goals of the project on the homepage.</li><li>Completely rework the information architecture, from domains down to individual pages and sections.</li><li>Set up <a href="https://events.dartlang.org/">events.dartlang.org</a> for hosting event-related micro-sites.</li><li>Reimplement the sites to make maintenance easier.</li></ul>More significant changes will come, but we needed to land these changes before going further.<br />If you notice that something's broken or could just be better, please let us know using the relevant issue tracker:<br /><ul><li><a href="https://github.com/dart-lang/site-www/issues" target="_blank">www.dartlang.org issues</a></li><li><a href="https://github.com/dart-lang/site-webdev/issues" target="_blank">webdev.dartlang.org issues</a></li><li><a href="https://github.com/dart-lang/site-events/issues" target="_blank">events.dartlang.org issues</a></li></ul>Filip Hráčekhttp://www.blogger.com/profile/11956836702424010051noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-60783529820715981472016-06-15T13:12:00.001-07:002016-06-15T13:13:38.287-07:00Unboxing Packages: path<p>I want to do something a little different with my blog post this week. When I’ve written about packages in the past, I’ve mostly done a high-level overview of their APIs and how they fit into the Dart ecosystem as a whole. But <a href="https://pub.dartlang.org/packages/path"><code>path</code></a> is one of the very oldest packages in the ecosystem, and any Dart user who’s written any server-side or command-line apps is probably already familiar with the API.</p> <p>So instead of a high-level overview, I want to do a deep dive. I want to talk about why we made the design decisions we made when writing <code>path</code>, and how we implemented our design effectively and efficiently. This post will be as much about <em>how</em> the package was constructed as it is about what the final product looks like.</p> <h2 id="initial-design">Initial Design</h2> <p>It first became clear that Dart needed a solid solution for path manipulation when <a href="https://github.com/munificent">Bob Nystrom</a> and I first started working on <a href="https://www.dartlang.org/tools/pub/">pub</a>. Paths may seem simple on their face, but there’s a lot of hidden complexity when you need to make them work with all the edge case formats that can crop up across all the operating systems we support.</p> <p>This became our first design constraint: <strong>make something that handles all the edge-cases</strong>. This is less obvious than it sounds: a lot of times, good design involves sacrificing some edge-case behavior to make the common case better, or even just simpler to implement. But we knew that <code>path</code> would be widely-used across the ecosystem, and we wanted users to be totally confident in it. If an application had to sanitize its paths before handing them off to us, we weren’t doing our job.</p> <p>Another important early decision was to <strong>make the core API use top-level methods</strong>. We often look at other languages’ APIs for inspiration, but they were split on this point. Node uses <a href="https://nodejs.org/api/path.html">top-level functions</a>, whereas Java uses <a href="https://nodejs.org/api/path.html">instance methods on a <code>Path</code> class</a>. Ruby uses <a href="http://ruby-doc.org/core-2.2.0/File.html#method-c-basename">static methods</a> for simple manipulation and <a href="http://ruby-doc.org/stdlib-2.2.0/libdoc/pathname/rdoc/Pathname.html">a <code>Pathname</code> class</a> for more complex ones. This didn’t provide clear guidance.</p> <p>We decided to rely on a rule of thumb: <em>only create a class when it’s the canonical representation of its data type</em>¹. There were already a bunch of APIs, both in the core and in external code, that logically took paths and accepted only strings, not our hypothetical <code>Path</code> objects. Certainly everywhere the end user supplied a path, that path would be made available to the program as a string.</p> <p>So we decided to go with the flow of the existing APIs and continue representing paths as strings. All the path manipulation APIs now take strings and return strings, and the world is simpler for it.</p> <p>We chose functions for the package based on a combination of our own needs and APIs that were common among other languages’ path manipulation suites. Some of them, like <a href="https://www.dartdocs.org/documentation/path/latest/path/join.html"><code>join()</code></a> and <a href="https://www.dartdocs.org/documentation/path/latest/path/relative.html"><code>relative()</code></a>, were pretty obvious. Others like <a href="https://www.dartdocs.org/documentation/path/latest/path/rootPrefix.html"><code>rootPrefix()</code></a> only became apparent because they filled holes in actual code. And a few, like <a href="https://www.dartdocs.org/documentation/path/latest/path/prettyUri.html"><code>prettyUri()</code></a>, only got added well after the package was released.</p> <h2 id="the-quest-for-correctness">The Quest for Correctness</h2> <p>We wanted to make our users confident in the correctness of <code>path</code>’s logic, which meant we had to be confident ourselves first. To do this, we wrote tests. Lots and lots of tests. Today, the package has 2.5 times more lines of test code than implementation code, and that’s how we like it.</p> <p>Writing tests isn’t trivial, though. We had to be careful to include all the cases that came up in practice. This meant that, for every function where they were relevant, we tested combinations of:</p> <ul><li>Directory paths that did or did not end in separators.</li><li>Paths with zero, one, or two extensions.</li><li>Paths with multiple separators in a row.</li><li>Paths containing, or entirely composed of, the directory traversal operators <code>.</code> and <code>..</code>.</li><li>Absolute and relative paths.</li><li>Different formats of the current working directory.</li></ul> <p>We wrote those tests first for the Posix style of path, which are used by OS X and Linux. Then we ported them over to Windows paths², and added even more cases:</p> <ul><li>Windows supports both <code>/</code> and <code>\</code> as separators, so we tested both and their combinations.</li><li>Not only does Windows support <code>C:\</code>-style path roots, it supports <code>\\server\share\</code>-style UNC paths as well.</li><li>You can also start a path with <code>\</code> in Windows to indicate that it’s relative to the current working directory’s roots.</li></ul> <p>Determining the proper behavior for all of these involved looking up specifications online, manually testing path behavior on the command line, and a healthy amount of discussion about exactly the right way to handle edge-cases. These discussions led to our next round of design decisions.</p> <p>Not all paths are valid. Sometimes they run afoul of an operating system’s rules for valid characters, and sometimes they just don’t make sense at all—consider the path <code>/..</code>, for example, or just an empty string. I initially advocated for throwing errors in these cases since in general failing fast is good, but we discussed options and Bob convinced me that <strong>path operations should never fail</strong>³.</p> <p>While failing fast can make errors easier to track down, it also means that a defensive programmer has to be aware of the potential for failure anywhere it could occur. Path operations are frequently used in small utility methods that aren’t expected to fail, and most of the time their output is ultimately passed to IO operations which already need error handling.</p> <p>So instead of throwing an error, the path operations just do the best they can on meaningless input. For most operations, <code>/..</code> is considered the same as <code>/</code> and the empty path is considered the same as <code>.</code>, but we don’t work too hard to adhere to these definitions if it would get in the way of efficiently processing valid paths.</p> <p>We also had to figure out what to do with paths that contained irrelevant characters, like <code>foo//bar</code> or <code>foo/./bar</code>, both of which are semantically identical to <code>foo/bar</code>. We ended up deciding to <strong>preserve the existing format as much as possible</strong>. The user would be able to explicitly call <a href="https://www.dartdocs.org/documentation/path/latest/path/normalize.html"><code>normalize()</code></a> if they wanted clean paths, but otherwise they’d get something like what they passed in.</p> <p>This decision made it easier to interoperate with other software that did, for whatever reason, care about the exact format of a path. For example, code using less-robust path manipulation logic might not be able to tell that <code>foo/baz/qux</code> was within <code>foo/bar/../baz</code>, so it’s useful for <code>p.join("foo/bar/../baz", "qux")</code> to return <code>"foo/bar/../baz/qux"</code>.</p> <h2 id="platforms-and-customization">Platforms and Customization</h2> <p>Paths are unusual in that their semantics are deeply platform-specific, but following those semantics mostly doesn’t actually require running the code on the platform in question. We wanted to take advantage of this to allow users to do path manipulations for platforms they weren’t using, but we also wanted to make the easy default use the current platform. This called for more design.</p> <p>We came up with the idea of a <a href="https://www.dartdocs.org/documentation/path/latest/path/Context/Context.html"><code>Context</code></a> object, which would take a style of path (Posix, Windows, or eventually URI) and the only OS-specific piece of data path manipulation used—the current directory path. <code>Context</code> had a set of methods that exactly mirrored the top-level functions in <code>path</code>. In fact, <code>path</code>’s functions just forward to a context!</p> <p>We used contexts heavily in our own tests. They allowed us to run Windows path tests on Linux, for example, and to test operations like <code>relative()</code> without having to make any assumptions about the current directory.</p> <p>While adding contexts, we also made a design decision that turned out to be a mistake in retrospect. We’d defined a <a href="https://www.dartdocs.org/documentation/path/latest/path/Style-class.html"><code>Style</code></a> enum for determining which platform style a context should use, which would have been fine if we hadn’t decided to make public the methods <code>Context</code> called on the style.</p> <p>We had a vague notion that this would allow third-party packages to define custom styles, but no one ever did. Even if they’d wanted to, different path styles are so idiosynctatic that they probably couldn’t have encoded all the custom logic in the methods we provided. So instead we had a bunch of public API surface that was tightly coupled to the internal implementation of path manipulation.</p> <p>Eventually the implementation needed tweaking in a way that affected the <code>Style</code> methods. We couldn’t change those methods, so instead we deprecated them and added an internal implementation of <code>Style</code> where we could add new methods privately. The lesson here is <strong>sometimes maximal extensibility isn’t worth the pain</strong>.</p> <h2 id="making-it-fast">Making it Fast</h2> <p>When we first implemented <code>path</code>, we were primarily concerned with correctness and not speed. Our philosophy was (and is) to avoid optimizing packages until we have a clear idea of what parts are slowest and used most heavily. If the package started out correct and well-tested, we could be sure that any performance improvements later on preserved the necessary behavior.</p> <p>But eventually the time came to make those changes. Users were doing path manipulations in performance-critical loops, and that meant it had to be fast. We set up a benchmark so we could track our progress, and used <a href="https://dart-lang.github.io/observatory/">Observatory</a> to see exactly what parts of our code were taking the most time. Then we called in <a href="https://github.com/skabet">Anders Johnsen</a>, one of our resident performance experts who’s since moved on from Google, to see what he could do.</p> <p>It turned out he could do a lot! Not only did our code get faster, we learned quite a bit about strategies for keeping it fast.</p> <p>The first change was to <strong>avoid parsing the whole path</strong>. Our original code heavily used an internal <code>ParsedPath</code> class that eagerly parsed the entire path and exposed its components as fields. We still use this class for particularly complex functions, but for anything simple and performance-critical, we now deal with the string directly. This removes a lot of extra unnecessary work and allocations.</p> <p>The second change was to <strong>stop using regular expressions</strong>. At the time, Dart’s regular expression engine was very slow. It’s since been dramatically improved, but explicit string operations still tend to involve a lot less overhead. We had been using regexps for very simple operations anyway, so switching away from them ended up being pretty straightforward.</p> <p>Finally, we had to <strong>short-circuit early when possible</strong>. A lot of path operations were very complex in the worst case—they required a lot of logic and maybe even iteration over the whole path. But the worst case didn’t actually come up all that often, and it turned out to be pretty easy to detect when it didn’t. For example, Windows paths can have a lot of different roots, which makes finding the root difficult. But if the path starts with <code>/</code>, then it’s guaranteed to be a root-relative path, so the root is <code>"/"</code>. These sorts of checks may seem nitty, but they helped a lot.</p> <h2 id="coming-up-for-air">Coming Up For Air</h2> <p>I tried something new today, and I’m curious what you thought. Leave me feedback in the comments if you’d like to see more deep dives, or if you prefer my previous articles that gave a high-level overview of package APIs. For my part, I like writing both of them, so I’d be happy to continue doing a mix in the future.</p> <p>Join me again in two weeks when I cover a very generalized package that’s only used in one place so far.</p> <p><em><a href="https://twitter.com/nex3">Natalie</a> is still doing the writing here. I’m just hitting publish. – Kevin</em></p> <hr> <p>1: If it were up to me, the <a href="https://api.dartlang.org/stable/latest/dart-io/File-class.html"><code>File</code></a> class’s methods would be top-level functions as well.</p> <p>2: We also support <a href="https://www.dartdocs.org/documentation/path/latest/path/Style/url.html"><code>url</code></a> paths, but these were added later on.</p> <p>3: There’s one exception to this rule: <code>path</code> calls <a href="https://api.dartlang.org/stable/latest/dart-core/Uri/base.html"><code>Uri.base</code></a> to figure out the working directory for operations like <a href="https://www.dartdocs.org/documentation/path/latest/path/relative.html"><code>relative()</code></a>, which is an IO operation and so could <em>theoretically</em> fail. In pratice, though, it basically never does.</p>Kevin Moorehttp://www.blogger.com/profile/08411979841477351623noreply@blogger.com0tag:blogger.com,1999:blog-1636601191077561071.post-15115107481886723272016-06-09T02:38:00.000-07:002016-06-09T10:55:10.945-07:00Dart 1.17: More performance improvementsDart 1.17 is now available.&nbsp;<a href="https://www.dartlang.org/downloads/">Get it now!</a><br /><br />We continued the work from 1.16 of working closely with some of our <a href="http://news.dartlang.org/2016/03/the-new-adwords-ui-uses-dart-we-asked.html">key users</a> at Google to make sure Dart is even more productive for developers. <br /><br />We've additionally optimized how our core tools deal with large applications, and have seen significant improvement over the last two releases. Dartium is now much more stable. We have improved the speed of the Dart Analyzer by more than 200% on large codebases. Last, but not least, Dartium startup time on large applications at Google has improved by a factor of 4.<br /><br /> We also made a number of smaller changes to core SDK APIs, please refer to the <a href="https://github.com/dart-lang/sdk/blob/master/CHANGELOG.md">SDK changelog</a>. <div><br /></div>Anders Thorhauge Sandholmhttp://www.blogger.com/profile/02074725733613485890noreply@blogger.com0