<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7408950498410688785</id><updated>2024-11-01T20:39:18.064+09:00</updated><category term="dart"/><category term="dartlang"/><category term="dart editor"/><category term="dartium"/><category term="language"/><category term="future"/><category term="specification"/><category term="completer"/><category term="dart vm"/><category term="string"/><category term="windows"/><category term="interface"/><category term="mode"/><category term="news"/><category term="class"/><category term="frogc"/><category term="function"/><category term="library"/><category term="type"/><category term="ubuntu"/><category term="book"/><category term="browser"/><category term="bulid"/><category term="cascade"/><category term="catch"/><category term="check"/><category term="closure"/><category term="constructor"/><category term="dom"/><category term="double"/><category term="dynamic"/><category term="eclipse"/><category term="equality"/><category term="exception"/><category term="fibonacci"/><category term="finally"/><category term="get"/><category term="getter"/><category term="html"/><category term="httprequest"/><category term="import"/><category term="int"/><category term="intellij idea"/><category term="interpolation"/><category term="is"/><category term="isolate"/><category term="javascript"/><category term="main"/><category term="milestone 1"/><category term="num"/><category term="options"/><category term="parameter"/><category term="podcast"/><category term="private"/><category term="production"/><category term="script"/><category term="sdk"/><category term="set"/><category term="setter"/><category term="source"/><category term="stopwatch"/><category term="try"/><category term="typedef"/><category term="var"/><category term="xmlhttprequest"/><title type='text'>Dart -ing</title><subtitle type='html'>Dartプログラミング言語の情報。 #dartlang</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>53</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-3613111648645785053</id><published>2013-08-28T16:59:00.001+09:00</published><updated>2013-08-28T17:00:17.174+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart editor"/><title type='text'>Dart Editor をプロキシ経由で更新する</title><content type='html'>Dart Editor はメニューの Tools - Preferences あるいは Help - About Dart Editor で更新できますが、プロキシ経由でインターネットにアクセスする環境では、更新サーバーに接続できずエラーになる場合があります。この場合は次の方法を試してみてください。
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Dart Editor を終了する。&lt;/li&gt;
&lt;li&gt;Dart Editor の実行ファイルと同じ場所にある DartEditor.ini ファイルをテキストエディタで開く。&lt;/li&gt;
&lt;li&gt;「-Dhttp.proxyHost=」「-Dhttp.proxyPort=」という行を追加し、設定を書く。認証が必要なプロキシの場合は「-Dhttp.prxyUser=」「-Dhttp.proxyPassword=」も設定する。&lt;/li&gt;
&lt;li&gt;DartEditor.ini ファイルを保存する。&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
設定すると DartEditor.ini は次のようになります。
&lt;pre&gt;
（前半省略）
-Xms40m
-Xmx1000m
-Dhttp.proxyHost=proxy.example.com
-Dhttp.proxyPort=8080
-Dhttp.proxyUser=account_name
-Dhttp.proxyPassword=account_password
&lt;/pre&gt;
Dart Editor 0.6.21_r26639 と、Windows XP および Ubuntu 13.04 の環境で確認しました。
</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/3613111648645785053/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2013/08/dart-editor.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/3613111648645785053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/3613111648645785053'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2013/08/dart-editor.html' title='Dart Editor をプロキシ経由で更新する'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-5539905447696143199</id><published>2013-05-08T13:48:00.001+09:00</published><updated>2013-05-29T16:26:07.778+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="completer"/><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="future"/><title type='text'>Future を使いこなす（３）</title><content type='html'>&lt;b&gt;目次&lt;/b&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2013/05/efficientfuturem41.html&quot;&gt;Future を使いこなす（１）&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Future とは何か（おさらい）&lt;/li&gt;
&lt;li&gt;基本の Future の書き方&lt;/li&gt;
&lt;li&gt;エラー発生時の処理を記述する&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2013/05/efficientfuturem42.html&quot;&gt;Future を使いこなす（２）&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Future を続けて処理する&lt;/li&gt;
&lt;li&gt;連結時のエラー処理を実装する&lt;/li&gt;
&lt;li&gt;リストの要素を Future で順に処理する&lt;/li&gt;
&lt;li&gt;複数の Future をまとめて待つ&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Future を使いこなす（３）&lt;/b&gt;&lt;ul&gt;
&lt;li&gt;Future を返す関数を実装する&lt;/li&gt;
&lt;li&gt;Future をテストする&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;Future を返す関数を実装する&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
非同期処理の関数を実装するときには &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Future.html&quot;&gt;Future&lt;/a&gt; のインスタンスを返すようにします。
関数の中で別の非同期処理関数を呼び出して適切な Future を返すということが多いと思いますが、場合によっては自分で非同期処理を書いて Future を返すこともあるでしょう。&lt;br /&gt;
&lt;br /&gt;
自分で Future を生成するときには &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Completer.html&quot;&gt;Completer&lt;/a&gt; を使います。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future&amp;lt;String&gt; asyncTask() {
  var c = new Completer&amp;lt;String&gt;();

  // ここで非同期処理を実行する。

  // Completer#future を返す。
  return c.future;
}

void main() {
  asyncTask()
    .then(print)
    .catchError((e) =&gt; print(&#39;ERROR: $e&#39;));
}&lt;/pre&gt;
非同期処理が完了したことを通知するためには &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Completer.html#complete&quot;&gt;Completer#complete&lt;/a&gt; を使います。
同じように、エラーが発生したことを通知するためには &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Completer.html#completeError&quot;&gt;Completer#completeError&lt;/a&gt; を使います。&lt;br /&gt;
&lt;br /&gt;
では試しに、&lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Timer.html&quot;&gt;Timer&lt;/a&gt; を使って非同期処理を作ってみます。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future&amp;lt;String&gt; asyncTask() {
  var c = new Completer&amp;lt;String&gt;();

  // 非同期処理
  const ONE_SEC = const Duration(seconds: 1);
  new Timer(ONE_SEC, () {
    c.complete(&#39;Pass&#39;);
    // エラーの時は
    // c.completeError(&#39;Fail&#39;);
  });

  // Completer#future を返す。
  return c.future;
}

void main() {
  asyncTask()
    .then(print)
    .catchError((e) =&gt; print(&#39;ERROR: $e&#39;));
}&lt;/pre&gt;
実行すると 1 秒後に then で登録した関数が呼びだされ、結果が表示されます。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Future をテストする&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
自動テストを実行するには &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/unittest.html&quot;&gt;unittest&lt;/a&gt; ライブラリを使います。
pubspec.yaml に unittest を追加してください。
Dart Editor ならば GUI で設定できます。
テキストエディターで変更する場合は、次のように dependencies に unittest を追加します。
&lt;pre class=&quot;prettyprint lang-yaml&quot;&gt;dependencies:
  unittest: any
&lt;/pre&gt;
できたら pub install を実行します（Dart Editor の場合は自動で実行されます）。&lt;br /&gt;
&lt;br /&gt;
まず同期処理の場合のテストコードです。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import &#39;dart:async&#39;;
import &#39;package:unittest/unittest.dart&#39;;

String syncTask() =&gt; &#39;Pass&#39;;

void main() {
  test(&#39;Test a function&#39;, () {
    expect(syncTask(), equals(&#39;Pass&#39;));
  });
}
&lt;/pre&gt;
これに対して非同期処理のテストコードは次のようになります。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import &#39;dart:async&#39;;
import &#39;package:unittest/unittest.dart&#39;;

Future&amp;lt;String&gt; asyncTask() {
  var c = new Completer&amp;lt;String&gt;();

  const ONE_SEC = const Duration(seconds: 1);
  new Timer(ONE_SEC, () =&gt; c.complete(&#39;Pass&#39;));

  return c.future;
}

void main() {
  // テスト
  test(&#39;Test a future&#39;, () {
    asyncTask().then(
      expectAsync1(
        (e) =&gt; expect(e, equals(&#39;Pass&#39;))));
  });
}
&lt;/pre&gt;
Future#then や Future#catchError などに &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/unittest.html#expectAsync1&quot;&gt;expectAsync1&lt;/a&gt;（1 は引数の個数）で取得した関数を渡してテストします。
同期処理のテストと若干が違いますが、おおよそ似たような形で書くことができます。&lt;br /&gt;
&lt;br /&gt;
ただし expectAsync1 は今後の言語仕様の変更にともなって呼び出し方が変更される可能性があります。
あまり気にすることはないと思いますが、覚えておくと良いかもしれません。</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/5539905447696143199/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2013/05/efficientfuturem43.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/5539905447696143199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/5539905447696143199'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2013/05/efficientfuturem43.html' title='Future を使いこなす（３）'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-9039711100835267230</id><published>2013-05-08T13:48:00.000+09:00</published><updated>2013-05-29T16:25:52.767+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="completer"/><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="future"/><title type='text'>Future を使いこなす（２）</title><content type='html'>&lt;b&gt;目次&lt;/b&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2013/05/efficientfuturem41.html&quot;&gt;Future を使いこなす（１）&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Future とは何か（おさらい）&lt;/li&gt;
&lt;li&gt;基本の Future の書き方&lt;/li&gt;
&lt;li&gt;エラー発生時の処理を記述する&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Future を使いこなす（２）&lt;/b&gt;&lt;ul&gt;
&lt;li&gt;Future を続けて処理する&lt;/li&gt;
&lt;li&gt;連結時のエラー処理を実装する&lt;/li&gt;
&lt;li&gt;リストの要素を Future で順に処理する&lt;/li&gt;
&lt;li&gt;複数の Future をまとめて待つ&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2013/05/efficientfuturem43.html&quot;&gt;Future を使いこなす（３）&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Future を返す関数を実装する&lt;/li&gt;
&lt;li&gt;Future をテストする&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;Future を続けて処理する&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
ある &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Future.html&quot;&gt;Future&lt;/a&gt; の結果を元に、別の Future を使った処理を呼び出したいことがあります。その時は次のように書くことができます。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future&amp;lt;String&gt; asyncTask1() { /* ... */ }
Future&amp;lt;String&gt; asyncTask2(String s) { /* ... */ }

main() {
  Future&amp;lt;String&gt; f1 = asyncTask1();
  Future&amp;lt;String&gt; f2 = f1.then((s) {
    return asyncTask2(s);
  });
  f2.then((s) =&amp;gt; print(s));
}&lt;/pre&gt;
&lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Future.html#then&quot;&gt;Future#then&lt;/a&gt; に指定したコールバック関数が Future のインスタンスを返す場合（つまりこのコードの &lt;code&gt;return asyncTask2(s)&lt;/code&gt; のようになっている場合）、元々の Future（f1）と連結された新しい Future が then の戻り値（f2）となります。
したがってこのように書くと、asyncTask1 で生成された Future の処理が完了したあとに asyncTask2 で生成された Future が続けて処理されるようになります。&lt;br /&gt;
&lt;br /&gt;
このコードは、より簡潔に次のように書くこともできます。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future&amp;lt;String&gt; asyncTask1() { /* ... */ }
Future&amp;lt;String&gt; asyncTask2(String s) { /* ... */ }

main() {
  asyncTask1()
    .then((s) =&amp;gt; asyncTask2(s))
    .then((s) =&amp;gt; print(s));

  // あるいは

  asyncTask1()
    .then(asyncTask2)
    .then(print);
}&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;連結時のエラー処理を実装する&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Future を連結させた場合、どの Future で発生したエラーも最後の Future で受け取ることができます。
つまり次のように書けるということです。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future&amp;lt;String&gt; asyncTask1() {
  // ここでエラーが発生しても...
}
Future&amp;lt;String&gt; asyncTask2(String s) {
  // ここでエラーが発生しても...
}

main() {
  asyncTask1()
    .then(asyncTask2)
    .catchError((e) { /* ここでエラーが処理できる。 */ })
    .whenComplete(() { /* ここは最後に実行される。 */ });
}&lt;/pre&gt;
見た目は少し異なりますが、try-catch と同じように扱えると考えれば迷わないでしょう。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;リストの要素を Future で順に処理する&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
一つずつ Future を連結していくこともできますが、List のような Iterable な構造に入っているデータを順に Future で処理させるときには &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Future.html#forEach&quot;&gt;Future#forEach&lt;/a&gt; が使えます。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future asyncTask(String s) { /* ... */ }

main() {
  List&amp;lt;String&gt; strs = [&#39;a&#39;, &#39;b&#39;, &#39;c&#39;];

  // strs の要素が一つずつ渡されて処理される。
  Future f = Future.forEach(strs, asyncTask);

  // 最後の要素が処理されると呼び出される。
  f.then((_) =&gt; print(&#39;Completed.&#39;));
}&lt;/pre&gt;
Future を then でつなげていった時と同じように、&#39;a&#39; の処理が終わったら &#39;b&#39;、&#39;b&#39; の処理が終わったら &#39;c&#39;、すべて終わったら最後の then という順番で処理されます。&lt;br /&gt;
&lt;br /&gt;
途中の Future で値が返ってきてもそれらは捨てられてしまいますので、結果を受け取りたい場合には呼び出し元と呼び出し先で共通に参照できるオブジェクトを用意して、そこに結果を格納していくなどの方法を取る必要があります。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;複数の Future をまとめて待つ&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
今度は Future をつなげて順に処理させるのではなく、複数の非同期で処理されている Future の完了をまとめて待つ方法です。
このような場合には &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Future.html#wait&quot;&gt;Future#wait&lt;/a&gt; が使えます。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future asyncTask(String s) { /* ... */ }

main() {
  // List に複数の Future を入れておく。
  List&amp;lt;Future&gt; fs = [
    asyncTask(&#39;a&#39;),
    asyncTask(&#39;b&#39;),
    asyncTask(&#39;c&#39;)
  ];

  // まとめて待つ。
  Future f = Future.wait(fs);
  f.then((_) =&gt; print(&#39;Completed.&#39;));
}&lt;/pre&gt;
List に入っている３つの Future はそれぞれ非同期に実行され、すべての Future が完了した時点で最後の Future の then に登録した関数が呼ばれます。
それぞれの結果はやはり捨てられますので、結果は別のオブジェクトに保存するなどしてください。 &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://dart-ing.blogspot.com/2013/05/efficientfuturem43.html&quot;&gt;Future を使いこなす（３）&lt;/a&gt; へ続く</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/9039711100835267230/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2013/05/efficientfuturem42.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/9039711100835267230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/9039711100835267230'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2013/05/efficientfuturem42.html' title='Future を使いこなす（２）'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-7547524749129234901</id><published>2013-05-08T13:47:00.002+09:00</published><updated>2013-05-29T16:25:39.021+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="completer"/><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="future"/><title type='text'>Future を使いこなす（１）</title><content type='html'>Dart の Future についてはだいぶ前に解説（&lt;a href=&quot;http://dart-ing.blogspot.com/2012/04/dartfuture.html&quot;&gt;Dartで未来（Future）の処理を実装する&lt;/a&gt;）を書きましたが、それから使い方が少し変わっていますので、現時点での最新仕様（Milestone 4）をベースに改めて説明を書きました。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;目次&lt;/b&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Future を使いこなす（１）&lt;/b&gt;&lt;ul&gt;
&lt;li&gt;Future とは何か（おさらい）&lt;/li&gt;
&lt;li&gt;基本の Future の書き方&lt;/li&gt;
&lt;li&gt;エラー発生時の処理を記述する&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2013/05/efficientfuturem42.html&quot;&gt;Future を使いこなす（２）&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Future を続けて処理する&lt;/li&gt;
&lt;li&gt;連結時のエラー処理を実装する&lt;/li&gt;
&lt;li&gt;リストの要素を Future で順に処理する&lt;/li&gt;
&lt;li&gt;複数の Future をまとめて待つ&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2013/05/efficientfuturem43.html&quot;&gt;Future を使いこなす（３）&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Future を返す関数を実装する&lt;/li&gt;
&lt;li&gt;Future をテストする&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;b&gt;Future とは何か（おさらい）&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Future.html&quot;&gt;Future&lt;/a&gt; は Dart のライブラリとして提供されている、非同期処理のための機能です。結果がすぐに得られるかわからない処理を同期的に書いてしまうと、その処理が終わるまで次の処理がブロックされてしまいます。例えば Web からリソースを取得するとき、いつ結果が返ってくるか（あるいはエラーになるのか）を予測してプログラミングすることはほとんど不可能です。&lt;br /&gt;
&lt;br /&gt;
それでは都合が悪いので、どのくらい時間がかかるかわからないような処理は非同期で実行し、結果が出た時にそれに対応する処理を実行させるということをよくやります。これを実現するための機能が Future です。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;基本の Future の書き方&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Future の機能は &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async.html&quot;&gt;dart:async&lt;/a&gt; ライブラリで提供されていますので、プログラムの先頭で import する必要があります。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

void main() { /* ... */ }&lt;/pre&gt;
同期的な関数は戻り値として処理結果を返します。エラーが発生した場合には例外を送出します。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;// 同期的な関数
String concat(String a, String b) {
  return a + b;
}

void main() {
  // Hello world
  print(concat(&#39;Hello &#39;, &#39;world&#39;));
}&lt;/pre&gt;
concat 関数から戻った時点で print 関数へ渡す結果が出ています。これに対して非同期的な関数では、関数から戻った時点では結果が出ているかどうか分かりません。そのような場合、Dart の関数は Future のインスタンスが返るようになっています。処理が終わると &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Future.html#then&quot;&gt;Future#then&lt;/a&gt; で指定した関数がコールバックされますので、そこに結果の処理を記述します。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

// 非同期的な関数
Future&amp;lt;String&amp;gt; asyncTask() { /* ... */ }

void main() {
  // Future を受け取る。
  var f = asyncTask();

  // Future#then に完了時の処理を書く。
  f.then((String s) =&amp;gt; print(s));
}
&lt;/pre&gt;
実践的なプログラミングでは次のように短く書かれます。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future&amp;lt;String&amp;gt; asyncTask() { /* ... */ }

void main() {
  asyncTask().then(print);
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;エラー発生時の処理を記述する&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
非同期処理の中でエラーが発生した時や、then で登録したコールバック関数が例外を送出した時には、then の onError 引数に指定した関数が呼ばれます。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future&amp;lt;String&amp;gt; asyncTask() {
  // 非同期処理中にエラーが発生したり...
}

void main() {
  asyncTask().then(
    (s) {
      // コールバック関数内で例外が発生すると...
    },
    // onError が呼び出される。
    onError: (e) =&amp;gt; print(&#39;ERROR: $e&#39;));
}
&lt;/pre&gt;
あるいは &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Future.html#catchError&quot;&gt;Future#catchError&lt;/a&gt; を使って次のように書くこともできます。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future&amp;lt;String&amp;gt; asyncTask() { /* ... */ }

void main() {
  asyncTask()
    .then(print)
    .catchError((e) =&amp;gt; print(&#39;ERROR: $e&#39;));
}
&lt;/pre&gt;
エラーの処理では、エラーの型や内容によって処理を分けることがよくあります。Future#catchError では test 引数に bool 型の戻り値を持つ関数を渡し、そのコールバック関数でエラーを処理するかどうかを決められます。test 引数で指定した関数が true を返すとコールバック関数が呼び出され、false を返すと呼び出されません。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future&amp;lt;String&amp;gt; asyncTask() { /* ... */ }

void main() {
  asyncTask()
    .then(print)
    // int の場合はこちら
    .catchError((e) =&amp;gt; print(&#39;ERROR No.$e&#39;),
                test: (e) =&amp;gt; e is int)
    // String の場合はこちら
    .catchError((e) =&amp;gt; print(&#39;ERROR Message: $e&#39;),
                test: (e) =&amp;gt; e is String);
}
&lt;/pre&gt;
then と catchError を使った書き方は、同期処理における try-catch 構文に相当します。非同期処理と then で登録する関数は try ブロック、catchError で登録する関数は catch ブロックの処理に対応しています。そして finally に相当する &lt;a href=&quot;http://api.dartlang.org/docs/releases/latest/dart_async/Future.html#whenComplete&quot;&gt;Future#whenComplete&lt;/a&gt; も用意されています。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;import (&#39;dart:async&#39;);

Future&amp;lt;String&amp;gt; asyncTask() { /* ... */ }

void main() {
  asyncTask()
    .then(print)
    .catchError((e) =&amp;gt; print(&#39;ERROR No.$e&#39;),
                test: (e) =&amp;gt; e is int)
    .catchError((e) =&amp;gt; print(&#39;ERROR Message: $e&#39;),
                test: (e) =&amp;gt; e is String)
    .whenComplete(() =&amp;gt; print(&#39;Completed.&#39;));
}
&lt;/pre&gt;
正常に終了した場合は then と whenComplete、エラーが発生した場合は catchError と whenComplete で登録した関数が順に呼ばれます。 &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://dart-ing.blogspot.com/2013/05/efficientfuturem42.html&quot;&gt;Future を使いこなす（２）&lt;/a&gt; へ続く</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/7547524749129234901/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2013/05/efficientfuturem41.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/7547524749129234901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/7547524749129234901'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2013/05/efficientfuturem41.html' title='Future を使いこなす（１）'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-3670802203759888789</id><published>2013-04-03T18:20:00.000+09:00</published><updated>2013-05-08T17:30:52.816+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cascade"/><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="language"/><title type='text'>カスケード呼び出しを使う</title><content type='html'>ひとつのオブジェクトに対して複数のメソッドを呼び出す処理を書くことは多いと思います。このような操作を&lt;em&gt;カスケード呼び出し&lt;/em&gt;と言いますが、Dart ではこの呼び出し方を専用の書き方を使って簡潔に書くことができます。&lt;br /&gt;
&lt;br /&gt;
ここに動物のリストがあったとします。&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;&amp;lt;ul&amp;gt;
  &amp;lt;li id=&quot;bull&quot;&amp;gt;Bull&amp;lt;li&amp;gt;
  &amp;lt;li id=&quot;cat&quot;&amp;gt;Cat&amp;lt;li&amp;gt;
  &amp;lt;li id=&quot;dog&quot;&amp;gt;Dog&amp;lt;li&amp;gt;
&amp;lt;/ul&amp;gt;&lt;/pre&gt;
人気投票をしたところ Cat が 1 位になったので、太字にして王冠のイラストを追加してみましょう。&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;var licat = document.query(&#39;#cat&#39;);
licat.append(new Element.html(&#39;&amp;lt;img src=&quot;crown.png&quot;&amp;gt;&#39;))
licat.style.fontWeight = &#39;bold&#39;;
&lt;/pre&gt;
カスケード呼び出し（&lt;code&gt;..&lt;/code&gt;）を使うと次のように書くことができます。&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;document.query(&#39;#cat&#39;)
    ..append(new Element.html(&#39;&amp;lt;img src=&quot;crown.png&quot;&amp;gt;&#39;))
    ..style.fontWeight = &#39;bold&#39;;
&lt;/pre&gt;
先のコードに比べて読みやすい形で表現されていると思います。呼び出すメソッドの数が増えるほどカスケード呼び出しを使うメリットが増えます。&lt;br /&gt;
&lt;br /&gt;
ここで &lt;code&gt;document.query(&#39;#cat&#39;)&lt;/code&gt; の戻り値は li 要素になります。子要素を追加する append メソッドを普通に呼び出すと、その戻り値は追加した要素、つまりここでは img 要素です。しかし &lt;code&gt;..&lt;/code&gt; を使って呼び出すと、元々のメソッドの戻り値は無視され、元のオブジェクトが返ってきます。&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;var img = new Element.html(&#39;&amp;lt;img src=&quot;crown.png&quot;&amp;gt;&#39;);

// e は追加した子要素（つまり img 要素）
var e = document.query(&#39;#cat&#39;).append(img);

// f は document.query(&#39;#cat&#39;) の値（li 要素）
var f = document.query(&#39;#cat&#39;)..append(img);
&lt;/pre&gt;
カスケード オペレーターでは結果が元のオブジェクトになるので、同じオブジェクトに対して次のメソッドを呼び出すことができるわけです。&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;..&lt;/code&gt; は [] にも使うことができます。&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;document.query(&#39;#cat&#39;).attributes
    ..[&#39;style&#39;] = &#39;color: red&#39;
    ..[&#39;title&#39;] = &#39;popular&#39;;
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/3670802203759888789/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2013/04/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/3670802203759888789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/3670802203759888789'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2013/04/blog-post.html' title='カスケード呼び出しを使う'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-6872622628599180057</id><published>2012-08-17T13:23:00.000+09:00</published><updated>2012-08-17T13:25:37.449+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="language"/><category scheme="http://www.blogger.com/atom/ns#" term="podcast"/><category scheme="http://www.blogger.com/atom/ns#" term="specification"/><title type='text'>マイルストーン1を追いかける</title><content type='html'>GoogleのDart開発者たちは、マイルストーン1という区切りへ向けて開発を進めています。Dart EditorやEclipse用Dartプラグインのような開発環境や、Dart VMやdart2jsのような言語環境は日々更新されており、そしてDart言語仕様についても変更が予定されています。&lt;br /&gt;
&lt;br /&gt;
言語仕様については&lt;a href=&quot;http://code.google.com/p/dart/issues/list&quot; target=&quot;_blank&quot;&gt;Bugs and Feature Requests&lt;/a&gt;や&lt;a href=&quot;http://www.dartlang.org/mailing-list&quot; target=&quot;_blank&quot;&gt;メーリングリスト&lt;/a&gt;で議論されており、マイルストーン1に向けての大きなトピックが&lt;a href=&quot;http://www.dartlang.org/articles/m1-language-changes/&quot; target=&quot;_blank&quot;&gt;Milestone 1 Language Changes&lt;/a&gt;という文書でまとめて公開されています。&lt;br /&gt;
&lt;br /&gt;
ただしマイルストーン1の内容がすべて固まっているわけではなく、2012年8月17日現在で公開されている言語仕様は0.10ですが、マイルストーン1の内容は含んでいません。近いうちに0.11が公開されることになっていて、その内容はほぼマイルストーン1の仕様を反映したものになるようです。&lt;br /&gt;
&lt;br /&gt;
特にcode.google.comに公開されているBugs and Feature RequestsのページではDartのバグや要求がIssuesとして公開されており、これを見るとプロジェクトの進み具合がなんとなく分かります。マイルストーン1に向けたIssuesは&lt;a href=&quot;http://code.google.com/p/dart/issues/list?can=2&amp;amp;q=milestone=M1&quot;&gt;http://code.google.com/p/dart/issues/list?can=2&amp;amp;q=milestone=M1&lt;/a&gt;というURLで確認できます。&lt;br /&gt;
&lt;br /&gt;
また、この内容をChromeのボタンで監視できるサードパーティー製のエクステンションが&lt;a href=&quot;https://chrome.google.com/webstore/detail/dpebciclcfbkgmpoihiicadgkjdmlfli&quot; target=&quot;_blank&quot;&gt;Dart Milestone 1 monitor&lt;/a&gt;という名前で公開されており、これをインストールするとChromeでIssuesの数を見ることができます。まだ300個前後を行き来していますので収束するにはしばらくかかりそうですが、なんとなく見ているのも面白いと思います。&lt;br /&gt;
&lt;br /&gt;
英語の得意な方は、Dart開発者のビデオキャストやポッドキャスト&lt;a href=&quot;http://www.dartlang.org/dartisans/&quot; target=&quot;_blank&quot;&gt;Dartisans&lt;/a&gt;をチェックするのもよいでしょう。</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/6872622628599180057/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/08/1.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/6872622628599180057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/6872622628599180057'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/08/1.html' title='マイルストーン1を追いかける'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-1108458073642421448</id><published>2012-08-17T11:38:00.000+09:00</published><updated>2012-08-17T11:38:19.677+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="httprequest"/><category scheme="http://www.blogger.com/atom/ns#" term="milestone 1"/><category scheme="http://www.blogger.com/atom/ns#" term="xmlhttprequest"/><title type='text'>XMLHttpRequestがHttpRequestになります</title><content type='html'>XMLHttpRequest といえば、スクリプト内からサーバーへデータを要求するためによく使われる手段の一つですが、名前に反してデータの形式はXMLに限られているわけではありません。もちろんXMLもよく使われる形式ですが、最近はどちらかというとJSONの方が多くなっています。&lt;br /&gt;
&lt;br /&gt;
というわけで、Dartの&amp;nbsp;&lt;a href=&quot;http://api.dartlang.org/docs/continuous/dart_html/XMLHttpRequest.html&quot;&gt;XMLHttpRequest&lt;/a&gt;&amp;nbsp;は HttpRequest に名前を変えようという話になっているようです（&lt;a href=&quot;http://code.google.com/p/dart/issues/detail?id=912&quot; target=&quot;_blank&quot;&gt;Issue 912 - Rename &quot;XMLHttpRequest&quot; -&amp;gt; &quot;HttpRequest&quot; in dart:html&lt;/a&gt;）。今後どこかのタイミングで変更されることになりそうですが、変更されると今までのスクリプトを対応させる必要がありますので、覚えておくとよいでしょう。</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/1108458073642421448/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/08/xmlhttprequesthttprequest.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/1108458073642421448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/1108458073642421448'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/08/xmlhttprequesthttprequest.html' title='XMLHttpRequestがHttpRequestになります'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-8444595293394160832</id><published>2012-08-14T21:29:00.000+09:00</published><updated>2012-08-17T18:03:59.432+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dart editor"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><title type='text'>Eclipse用Dartプラグインを試す</title><content type='html'>Eclipse用のDartプラグインがプレビューとして公開されました。&lt;br /&gt;
&lt;br /&gt;
Dartの開発環境としてはEclipseベースのDart Editorがありましたが、プラグインではなく単体のアプリケーションという形で配布されていました。それに対してコミュニティーから多くの要望があったためか、今回Eclipseプラグインが公開されました。&lt;br /&gt;
&lt;br /&gt;
現時点ではプレビューという扱いになっていますので、普段利用している環境へはインストールしないほうが良いでしょう。とはいえ、Eclipseの豊富なプラグインが使えるのは魅力的ですので、今後に期待したいところです。&lt;br /&gt;
&lt;br /&gt;
アップデート サイトはこちらです。 &lt;a href=&quot;http://www.dartlang.org/eclipse/update/&quot;&gt;http://www.dartlang.org/eclipse/update/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
以下、実際にUbuntuでEclipseとDartプラグインをインストールしてみます。WindowsやMac OSでも同じようにインストールできるはずです。&lt;br /&gt;
&lt;br /&gt;
まずはEclipseをインストールします。Eclipseの動作に必要なJavaランタイムをインストールしましょう。Eclipseは &lt;a href=&quot;http://www.eclipse.org/downloads/&quot;&gt;Eclipse Downloads&lt;/a&gt; からダウンロードできます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf8A8REZUTvCpzm_ptoJs0JtrhTdeCdaZDiGr78vMmKwWZ_6BcBmLiQxvwX1Mo5GA8M4NXrKnDpkzWnyl72DrOmZikogfLYUTq_67Q3LrLmZgqQqk02NbfhinvaJJB3ge1eNIhIXUG65g/s1600/Screenshot+from+2012-08-14+17:51:59.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;316&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf8A8REZUTvCpzm_ptoJs0JtrhTdeCdaZDiGr78vMmKwWZ_6BcBmLiQxvwX1Mo5GA8M4NXrKnDpkzWnyl72DrOmZikogfLYUTq_67Q3LrLmZgqQqk02NbfhinvaJJB3ge1eNIhIXUG65g/s320/Screenshot+from+2012-08-14+17:51:59.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
現時点（2012/8/14）での最新版はEclipse Juno（4.2）です。ダウンロードしたファイルを展開し、Eclipseを実行しましょう。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVS4qYq9FnMLXyCN7C_fMpbxUf8d9kppgXXDdklK80hi-K1nQPSogFhYrEiRd_NkETkBNqyInhyphenhyphenD8aoX1GM8hlidLV9YeQ9EmptV001rqnBnTQqiuGQ-ZoZIgkpZh4NgwHnevVAycMeOc/s1600/Screenshot+from+2012-08-14+17:54:45.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;164&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVS4qYq9FnMLXyCN7C_fMpbxUf8d9kppgXXDdklK80hi-K1nQPSogFhYrEiRd_NkETkBNqyInhyphenhyphenD8aoX1GM8hlidLV9YeQ9EmptV001rqnBnTQqiuGQ-ZoZIgkpZh4NgwHnevVAycMeOc/s320/Screenshot+from+2012-08-14+17:54:45.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Eclipseのメインメニューから Window - Preferences を選びます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMwUbpvwiGJBWTwgnk2Bujgxzb9_o8QR0VG4LRNMbE2J9NTE6hH4wZQ3IUU-WsxAhuu6qatp1E2SYZK30tNkjq-jnODdwPR9I6Y1cInkJ9QrvSwpFRqpDEt36nk26H6xkFOV-y0j7Wm7g/s1600/Screenshot+from+2012-08-14+17:57:33.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMwUbpvwiGJBWTwgnk2Bujgxzb9_o8QR0VG4LRNMbE2J9NTE6hH4wZQ3IUU-WsxAhuu6qatp1E2SYZK30tNkjq-jnODdwPR9I6Y1cInkJ9QrvSwpFRqpDEt36nk26H6xkFOV-y0j7Wm7g/s320/Screenshot+from+2012-08-14+17:57:33.png&quot; width=&quot;317&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Install/Update - Available Software Site を選び、アップデート サイトを登録します。Nameは「Dart plugin for Eclipse」、Locationは「http://www.dartlang.org/eclipse/update/」にしましょう。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvq003mlodQG_5-KR0g8g9QzYoH957q-RsfnNiYfs1b_1esbwtoZW-jrxlDRro2fS6n5jutkvZWRVAfrlRsRFdqYzTEyva36WUHED8bIJAY-1M8QGtkhKK4f6pEhtxpJg1R6Mi3f3RlS4/s1600/Screenshot+from+2012-08-14+17:58:55.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;188&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvq003mlodQG_5-KR0g8g9QzYoH957q-RsfnNiYfs1b_1esbwtoZW-jrxlDRro2fS6n5jutkvZWRVAfrlRsRFdqYzTEyva36WUHED8bIJAY-1M8QGtkhKK4f6pEhtxpJg1R6Mi3f3RlS4/s320/Screenshot+from+2012-08-14+17:58:55.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
次に、Eclipseのメイン画面に戻って、メニューの Help - Install New Software... を選びます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCOzNEKXtFX0NdeXdX0uaNmdS_oc5MOozLKqoT4yTKX3Ch_kpou23xaqhAw_XeQh0yZF6-wk1jDwcxz3QYSjtW9RxUWpus5GUyM2mqHVyAzKXLhHMQhOOcEIBzGi7dJVwZdFIH3GFNtW4/s1600/Screenshot+from+2012-08-14+17:59:35.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCOzNEKXtFX0NdeXdX0uaNmdS_oc5MOozLKqoT4yTKX3Ch_kpou23xaqhAw_XeQh0yZF6-wk1jDwcxz3QYSjtW9RxUWpus5GUyM2mqHVyAzKXLhHMQhOOcEIBzGi7dJVwZdFIH3GFNtW4/s1600/Screenshot+from+2012-08-14+17:59:35.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Installウィンドウの Work with: で、先ほど登録したアップデート サイトを選びます。すると画面の下部にDart Editorが現れますので、選択して次へ進みます。&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6X1QmSsdYT5RZw2XWoeA5_ivPqLzpR7dN4UuutpwRwnJrmmFVD2_HtCcW88RiNiGTYxpW7hhC4BfOBQjE8Tsp-Wjte6iqjqZExEY2Ukoy4vVsm6zQp_mlaeeQYja7GiH_D39q2haKgNY/s1600/Screenshot+from+2012-08-14+18:00:03.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;152&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6X1QmSsdYT5RZw2XWoeA5_ivPqLzpR7dN4UuutpwRwnJrmmFVD2_HtCcW88RiNiGTYxpW7hhC4BfOBQjE8Tsp-Wjte6iqjqZExEY2Ukoy4vVsm6zQp_mlaeeQYja7GiH_D39q2haKgNY/s320/Screenshot+from+2012-08-14+18:00:03.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
インストールが済むと再起動の確認が表示されますので、Yes を押して再起動します。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGEslQh-KuaEX7c0nlxFFF0vnrKW3ymV07Bk2A7FX2sfEMjTF3WbinUvVCo6tnykFAj2K0m2WGBLsfgn3j0Yku7xw6QerQWQiLDpZ7MieH-yNuzxHFemhmXZNXXd_mNPUDlhuj7fbHn5Q/s1600/Screenshot+from+2012-08-14+18:09:36.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;95&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGEslQh-KuaEX7c0nlxFFF0vnrKW3ymV07Bk2A7FX2sfEMjTF3WbinUvVCo6tnykFAj2K0m2WGBLsfgn3j0Yku7xw6QerQWQiLDpZ7MieH-yNuzxHFemhmXZNXXd_mNPUDlhuj7fbHn5Q/s320/Screenshot+from+2012-08-14+18:09:36.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Eclipseが再起動すると、自動的にDart SDKのダウンロードが始まります。画面右下に進捗が表示されます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1CvjWFLWrirccN4inoz1Vlp7NQABIzrnrt0JZIcrlp-8ISZXv8FjsB4wKzrJNsE-aNsFtIL0dXwRU7gRCXR6L9yO7VKpPYDDY0dmdLU2ynMPMNhOb-z9GJXf7Xjit_EtMChJq_M9An08/s1600/Screenshot+from+2012-08-14+18:32:59.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;155&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1CvjWFLWrirccN4inoz1Vlp7NQABIzrnrt0JZIcrlp-8ISZXv8FjsB4wKzrJNsE-aNsFtIL0dXwRU7gRCXR6L9yO7VKpPYDDY0dmdLU2ynMPMNhOb-z9GJXf7Xjit_EtMChJq_M9An08/s320/Screenshot+from+2012-08-14+18:32:59.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Dart SDKのダウンロードが終わったら、もう一度Eclipseを再起動させたほうが良いようです。それが済めばプラグインのインストールは完了です。&lt;br /&gt;
&lt;br /&gt;
まず、設定画面を開いてみましょう。メニューの Window - Preferences の画面から、Dart を選択します。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh11n0surjUoPd7H5_yECw4CRfhEqCbJPgn_VB8SnZy-k7Z0qAYAqHdjosH8twJ4tz-TjYCleZV_749NRvJkj4hTK4ufephIArj6DZR_hQXDZbcuI3xTsmJYJpNaQQbOGneXvDovFkZXTQ/s1600/Screenshot+from+2012-08-14+20:18:35.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;135&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh11n0surjUoPd7H5_yECw4CRfhEqCbJPgn_VB8SnZy-k7Z0qAYAqHdjosH8twJ4tz-TjYCleZV_749NRvJkj4hTK4ufephIArj6DZR_hQXDZbcuI3xTsmJYJpNaQQbOGneXvDovFkZXTQ/s320/Screenshot+from+2012-08-14+20:18:35.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
設定項目はDart Editorとほぼ同じです。ただしSDKという項目が増えており、ここでDart SDKの更新が行えるようです。Dartプラグインをインストールすれば、別途Dart SDKをダウンロードする必要はありません。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjByZsdVyj4NNM5G-eUIvQeOinaxzg8T4eK7J7Ydb2A8jpCzlchxQgQ4xm3On7_6u9iDyRNUyucT2hEGtSkOjiILlm4iwiayjLoCWSWT7E6ewXxAXaGEvASR5l2XYFreNkL6eMl2wQbgPE/s1600/Screenshot+from+2012-08-14+20:18:57.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjByZsdVyj4NNM5G-eUIvQeOinaxzg8T4eK7J7Ydb2A8jpCzlchxQgQ4xm3On7_6u9iDyRNUyucT2hEGtSkOjiILlm4iwiayjLoCWSWT7E6ewXxAXaGEvASR5l2XYFreNkL6eMl2wQbgPE/s320/Screenshot+from+2012-08-14+20:18:57.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Dart用のパースペクティブも用意されています。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwt6nRpqkqEtUspGYb1zRfR3z7WhDQ1DDODYzDx8ctF8UpsRjC9g3gyGLHYJ8AGNNnSL38fp8HpAzNgbfetEdcKMsLkE1YtDwqh4BzYPjUKSQznQZYgBDG9uCAYn9_weo7if5Y-mk05rs/s1600/Screenshot+from+2012-08-14+21:14:56.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwt6nRpqkqEtUspGYb1zRfR3z7WhDQ1DDODYzDx8ctF8UpsRjC9g3gyGLHYJ8AGNNnSL38fp8HpAzNgbfetEdcKMsLkE1YtDwqh4BzYPjUKSQznQZYgBDG9uCAYn9_weo7if5Y-mk05rs/s320/Screenshot+from+2012-08-14+21:14:56.png&quot; width=&quot;252&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
新規プロジェクトにもDartが追加されます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9ZEEFxSOtRCpdZNZ5t8R0LBLN2REjFgutHswKZLlpMOxZztxzWeEJYv5Nzb4CFsw2InxUdb3I1HhXpQ0XpWtl-CvjfRJ6MNcpSFxHLaxqhfZJrIZgloCeN2JbGZ7Ee9mRoxUf6PoXTCQ/s1600/Screenshot+from+2012-08-14+20:23:02.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;261&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9ZEEFxSOtRCpdZNZ5t8R0LBLN2REjFgutHswKZLlpMOxZztxzWeEJYv5Nzb4CFsw2InxUdb3I1HhXpQ0XpWtl-CvjfRJ6MNcpSFxHLaxqhfZJrIZgloCeN2JbGZ7Ee9mRoxUf6PoXTCQ/s320/Screenshot+from+2012-08-14+20:23:02.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Dart Editorで使えるリファクタリングやデバッグの機能も使えますし、もちろんEclipseの他の機能やプラグインも使えます。&lt;br /&gt;
&lt;br /&gt;
短い時間ですが試してみた限りでも、いくつかよくわからない動作をする点も見られますが、やはりEclipse上で使えるという利点は大きいと思います。Eclipseに慣れている人であれば、Dart Editorよりもこちらを使ったほうが良さそうです。</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/8444595293394160832/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/08/eclipsedart.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/8444595293394160832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/8444595293394160832'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/08/eclipsedart.html' title='Eclipse用Dartプラグインを試す'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf8A8REZUTvCpzm_ptoJs0JtrhTdeCdaZDiGr78vMmKwWZ_6BcBmLiQxvwX1Mo5GA8M4NXrKnDpkzWnyl72DrOmZikogfLYUTq_67Q3LrLmZgqQqk02NbfhinvaJJB3ge1eNIhIXUG65g/s72-c/Screenshot+from+2012-08-14+17:51:59.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-8598566691249929038</id><published>2012-05-30T12:38:00.000+09:00</published><updated>2012-05-30T12:38:50.187+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="options"/><title type='text'>スクリプトの情報（引数など）を取得する</title><content type='html'>Dartではdart:coreの&lt;a href=&quot;http://api.dartlang.org/dart_core/Options.html&quot;&gt;Options&lt;/a&gt;を使うと、dartコマンドのパスや、スクリプトのパス、スクリプト起動時の引数を取得することができます。&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  Options opt = new Options();
  print(&quot;executable=${opt.executable}&quot;);
  print(&quot;script=${opt.script}&quot;);
  opt.arguments.forEach((e) =&amp;gt; print(&quot;argument=$e&quot;));
}&lt;/pre&gt;
このコードをDart Editor上で実行してみましょう。スクリプトへの引数はManage LaunchesのウィンドウからScript arguments欄に設定することができます。&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEosNmwKZfyELmRNtOF9V96zc_FIyjb-K32a624O9jC4DLeZ7e8miShzDnFl0ojkuf8FhmGiKjW1q5S_1_DbjZrTmjY6xe6cuv-XThWSS5idhnUZaHBtqpvqWjk6SkdFSrskPkiDSCZOY/s1600/Screenshot+from+2012-05-30+12:01:27.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;237&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEosNmwKZfyELmRNtOF9V96zc_FIyjb-K32a624O9jC4DLeZ7e8miShzDnFl0ojkuf8FhmGiKjW1q5S_1_DbjZrTmjY6xe6cuv-XThWSS5idhnUZaHBtqpvqWjk6SkdFSrskPkiDSCZOY/s320/Screenshot+from+2012-05-30+12:01:27.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
ここでは引数として「abc 123」と指定してみました。結果は次のようになります&lt;br /&gt;
&lt;pre&gt;executable=/home/dart-ing/Downloads/dart/dart-sdk/bin/dart
script=/home/dart-ing/dart/OptionsTest/OptionsTest.dart
argument=abc
argument=123&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/8598566691249929038/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/05/blog-post.html#comment-form' title='2 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/8598566691249929038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/8598566691249929038'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/05/blog-post.html' title='スクリプトの情報（引数など）を取得する'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEosNmwKZfyELmRNtOF9V96zc_FIyjb-K32a624O9jC4DLeZ7e8miShzDnFl0ojkuf8FhmGiKjW1q5S_1_DbjZrTmjY6xe6cuv-XThWSS5idhnUZaHBtqpvqWjk6SkdFSrskPkiDSCZOY/s72-c/Screenshot+from+2012-05-30+12:01:27.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-1808695937786790276</id><published>2012-05-22T10:14:00.001+09:00</published><updated>2012-05-22T10:15:16.149+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="intellij idea"/><title type='text'>IntelliJ IDEAのDartプラグインを使ってみる</title><content type='html'>JetBrainsが提供している統合開発環境の&lt;a href=&quot;http://www.jetbrains.com/idea/&quot; target=&quot;_blank&quot;&gt;IntelliJ IDEA 11&lt;/a&gt;に、&lt;a href=&quot;http://plugins.intellij.net/plugin/?idea&amp;amp;id=6351&quot; target=&quot;_blank&quot;&gt;Dart用のプラグイン&lt;/a&gt;があります。以前から提供されていましたが、最近バージョンアップされたので使ってみました。&lt;br /&gt;
&lt;br /&gt;
このプラグインはプラグインリポジトリに登録されていますので、IntelliJ IDEA上からインストールすることができます。リポジトリの一覧を開いて &lt;i&gt;Dart&lt;/i&gt; で検索するとプラグインが見つかります。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRp2VMERiQinHJicWZUtptfhnm1dwJqmiUWVm6U3VlD6LOnruyeg0pGYyGOKAw34q7JBePCiqD_OhZPfxx7IYvq-1AliibT727HX95QPGv_RKc77BX9_smB_v3SfpsNZShOerNi_bX0ws/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;267&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRp2VMERiQinHJicWZUtptfhnm1dwJqmiUWVm6U3VlD6LOnruyeg0pGYyGOKAw34q7JBePCiqD_OhZPfxx7IYvq-1AliibT727HX95QPGv_RKc77BX9_smB_v3SfpsNZShOerNi_bX0ws/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
プラグインをインストールすると、.dart ファイルをDartファイルとして認識します。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigJnP6bN2TER8ZuLtYwWcXxyNZPp0rw6LulMPwMnpN4sL3oaFMpT-0Dwz0rNXFWociPl8y93_BDbjuNYu_YHOYZQVuqsjAf7FEXaVjYqx2sYKR6MWb2xLKeAkr_gpW8POkEc4Bpw8iu2I/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;123&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigJnP6bN2TER8ZuLtYwWcXxyNZPp0rw6LulMPwMnpN4sL3oaFMpT-0Dwz0rNXFWociPl8y93_BDbjuNYu_YHOYZQVuqsjAf7FEXaVjYqx2sYKR6MWb2xLKeAkr_gpW8POkEc4Bpw8iu2I/s320/2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
文法もある程度認識しており、途中まで入力したクラスやメソッドを補完することもできます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBYRAN3z7E4LL7lnydAwcDm0gW22teIW-HhZTVxLRJ0_ToUDpMLRas_eYiXjN6d36JLif2k3eEytVY-QPtJ_EEhJd0j7kXbGHEqshc_86kVej-60qVvxrtzQ8kjIHOOAO93304L_UzkVo/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBYRAN3z7E4LL7lnydAwcDm0gW22teIW-HhZTVxLRJ0_ToUDpMLRas_eYiXjN6d36JLif2k3eEytVY-QPtJ_EEhJd0j7kXbGHEqshc_86kVej-60qVvxrtzQ8kjIHOOAO93304L_UzkVo/s320/3.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
今のところあまり機能は多くないため本格的な開発に使うというわけにはいきませんが、Dart Editor以外の選択肢として期待したいと思います。</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/1808695937786790276/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/05/jetbrains-intellij-idea-11-dart.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/1808695937786790276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/1808695937786790276'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/05/jetbrains-intellij-idea-11-dart.html' title='IntelliJ IDEAのDartプラグインを使ってみる'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRp2VMERiQinHJicWZUtptfhnm1dwJqmiUWVm6U3VlD6LOnruyeg0pGYyGOKAw34q7JBePCiqD_OhZPfxx7IYvq-1AliibT727HX95QPGv_RKc77BX9_smB_v3SfpsNZShOerNi_bX0ws/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-7121173282616181482</id><published>2012-05-16T10:52:00.001+09:00</published><updated>2012-05-16T11:32:20.477+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="catch"/><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="exception"/><category scheme="http://www.blogger.com/atom/ns#" term="finally"/><category scheme="http://www.blogger.com/atom/ns#" term="future"/><category scheme="http://www.blogger.com/atom/ns#" term="try"/><title type='text'>Dartで例外を処理する</title><content type='html'>Dartには例外処理の機能が備わっています。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;例外を受け取る&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
発生した例外を受け取るには、try - catch を使います。&lt;a href=&quot;http://try.dartlang.org/s/aTpA&quot; target=&quot;_blank&quot;&gt;サンプルコード&lt;/a&gt;&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  int a = 0;
  try {
    a.length;
  } catch (final NoSuchMethodException e) {
    print(e);
  }
}&lt;/pre&gt;
このコードではint型の変数のlengthプロパティを参照していますが、そのようなプロパティ（getterメソッド）はint型には存在しないので &lt;a href=&quot;http://api.dartlang.org/dart_core/NoSuchMethodException.html&quot; target=&quot;_blank&quot;&gt;NoSuchMethodException&lt;/a&gt; が発生します。これを catch で受け取っています。&lt;br /&gt;
&lt;br /&gt;
catch に型を指定しないこともでき、そうすることであらゆる型のオブジェクトを受け取ることができます。また、1つの try に対して複数の catch を書くこともできます。その場合は、上から順に見て行って最初に型が一致したものが実行されます。&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  int a = 0;

  try {
    a.length;
  } catch (final var e) {
    /* ここが実行されます。 */
  }

  try {
    a.length;
  } catch (final NoSuchMethodException e) {
    /* ここが実行されます。 */
  } catch (final e) {
    /* ここは実行されません。 */
  }
}&lt;/pre&gt;
例外発生箇所のスタックトレースを受け取るには、catch の2つめの要素として指定します。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  int a = 0;
  try {
    a.length;
  } catch (final NoSuchMethodException e, var stack) {
    print(&quot;exception: $e&quot;);
    print(&quot;stack: $stack&quot;);
    /*
exception: NoSuchMethodException : method not found: &#39;get:length&#39;
Receiver: 0
Arguments: []
stack: 0. Function: &#39;Object.noSuchMethod&#39; url: &#39;bootstrap&#39; line:2698 col:3
 1. Function: &#39;::main&#39; url: &#39;file:///home/dart-ing/dart/ExceptionTest/ExceptionTest.dart&#39; line:4 col:13
     */
  }
}&lt;/pre&gt;
このように例外を簡単に受け取ることができますが、実際には例外の発生を予期するのは難しいことです。コードの中で受け取られなかった例外は、実行環境側へ渡されて Unhandled exception としてそれぞれの方法で処理されます。&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;後処理を実装する&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
try を抜けた時に必ず実行されるコードを finally に書くことができます。&lt;a href=&quot;http://try.dartlang.org/s/yOQ_&quot; target=&quot;_blank&quot;&gt;サンプルコード&lt;/a&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  int a = 0;
  try {
    a.length;
  } catch (final NoSuchMethodException e) {
    print(e);
  }
  finally {
    print(&quot;finally&quot;);
  }
}&lt;/pre&gt;
この場合、catch による例外処理が行われてから、最後に finally が実行されます。 &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;例外を発生させる&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
例外を発生させるには throw を使います。&lt;a href=&quot;http://try.dartlang.org/s/8ctB&quot; target=&quot;_blank&quot;&gt;サンプルコード&lt;/a&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  try {
    throw new Exception(&quot;message&quot;);
  } catch (final Exception e) {
    print(e); // Exception: message
  }
}&lt;/pre&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;標準APIでの例外&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Dartの標準API（&lt;a href=&quot;http://api.dartlang.org/dart_core.html&quot; target=&quot;_blank&quot;&gt;dart:core&lt;/a&gt;など）にはあらかじめいくつかの例外が用意されています。それらはすべて &lt;a href=&quot;http://api.dartlang.org/dart_core/Exception.html&quot; target=&quot;_blank&quot;&gt;Exception&lt;/a&gt; から派生した型になっています。例外についてはいろいろな考え方がありますが、自分で例外を用意する場合には Exception から派生した型を使ったほうがわかりやすいでしょう。&lt;br /&gt;
&lt;br /&gt;
非同期処理でも例外を処理する必要があります。例えばファイルI/Oなどです。Dartでは &lt;a href=&quot;http://api.dartlang.org/io/File.html&quot; target=&quot;_blank&quot;&gt;File&lt;/a&gt; の非同期処理を &lt;a href=&quot;http://api.dartlang.org/dart_core/Future.html&quot; target=&quot;_blank&quot;&gt;Future&lt;/a&gt; を使って実装しているため、ファイルI/Oの例外処理をするならば Future の例外処理について知る必要があります。といっても特に難しいものではなく、例外が発生すると &lt;a href=&quot;http://api.dartlang.org/dart_core/Future.html#handleException&quot; target=&quot;_blank&quot;&gt;Future.handleException&lt;/a&gt; に指定した関数が呼ばれますので、そこで処理することになります。Future については以前の記事（&lt;a href=&quot;http://dart-ing.blogspot.jp/2012/04/dartfuture.html&quot;&gt;Dartで未来（Future）の処理を実装する&lt;/a&gt;）も参考にしてください。</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/7121173282616181482/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/05/dart.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/7121173282616181482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/7121173282616181482'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/05/dart.html' title='Dartで例外を処理する'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-8100004623110608580</id><published>2012-05-01T16:29:00.000+09:00</published><updated>2012-05-01T18:49:59.513+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="dom"/><category scheme="http://www.blogger.com/atom/ns#" term="html"/><title type='text'>dart:domは使えなくなります</title><content type='html'>公式サイトの情報（&lt;a href=&quot;http://news.dartlang.org/2012/04/deprecation-notice-migrate-from-dartdom.html&quot; target=&quot;_blank&quot;&gt;Deprecation notice: Migrate from dart:dom to dart:html&lt;/a&gt;）によると&lt;a href=&quot;http://api.dartlang.org/dom.html&quot; target=&quot;_blank&quot;&gt;dart:dom&lt;/a&gt;ライブラリは&lt;a href=&quot;http://api.dartlang.org/html.html&quot; target=&quot;_blank&quot;&gt;dart:html&lt;/a&gt;ライブラリに統合され、今後は使用できなくなります。もともとdart:htmlの使用が推奨されていましたし、dart:domを使ったプログラムを作りこまれている方は少ないとは思いますが、もしdart:domを使用していた場合にはdart:htmlへ移行する必要があります。&lt;br /&gt;
&lt;br /&gt;
dart:domからdart:htmlへの移行にあたっては、緊急避難として &quot;$dom_古い名前&quot; という形式のメソッド（例えば、Node.childNodes は &lt;a href=&quot;http://api.dartlang.org/html/Node.html#$dom_childNodes&quot; target=&quot;_blank&quot;&gt;Node.$dom_childNodes&lt;/a&gt;）としてdart:htmlライブラリ内に残されますが、いずれ消えることになりそうです。&lt;br /&gt;
&lt;br /&gt;
今後は、dart:domの代わりにdart:htmlを使用します。dart:htmlの使用方法については&amp;nbsp;&lt;a href=&quot;http://www.dartlang.org/articles/improving-the-dom/&quot; target=&quot;_blank&quot;&gt;Improving the DOM&lt;/a&gt;&amp;nbsp;が詳しいです。簡単に説明すると次のように使います。&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;HTMLElementのようなHTMLXxxという名前の代わりに、単にXxxとなっています（例：&lt;a href=&quot;http://api.dartlang.org/html/Element.html&quot; target=&quot;_blank&quot;&gt;Element&lt;/a&gt;、&lt;a href=&quot;http://api.dartlang.org/html/AnchorElement.html&quot; target=&quot;_blank&quot;&gt;AnchorElement&lt;/a&gt;）。ちなみにSVGXxxはそのままSVGXxxです。&lt;/li&gt;
&lt;li&gt;ノードを取り出すには getElementById などに代わって、&lt;a href=&quot;http://api.dartlang.org/html/Document.html#query&quot; target=&quot;_blank&quot;&gt;Document.query&lt;/a&gt;&amp;nbsp;と&amp;nbsp;&lt;a href=&quot;http://api.dartlang.org/html/Element.html#queryAll&quot; target=&quot;_blank&quot;&gt;Element.queryAll&lt;/a&gt;&amp;nbsp;という2つのメソッドを使います。&lt;/li&gt;
&lt;li&gt;コレクションはDOMのものではなく、DartネイティブのListやMapが使われます。&lt;/li&gt;
&lt;li&gt;新規の要素を作るのにdocument.createElementとする必要はなく、&lt;a href=&quot;http://api.dartlang.org/html/Element.html#Element&quot; target=&quot;_blank&quot;&gt;Element.tag&lt;/a&gt;&amp;nbsp;と &lt;a href=&quot;http://api.dartlang.org/html/Element.html#Element&quot; target=&quot;_blank&quot;&gt;Element.html&lt;/a&gt; コンストラクタを使用します。（例：new Document.tag(&#39;a&#39;) ）&lt;/li&gt;
&lt;li&gt;イベントは&amp;nbsp;&lt;a href=&quot;http://api.dartlang.org/html/Document.html#get:on&quot; target=&quot;_blank&quot;&gt;Document.on&lt;/a&gt;&amp;nbsp;で取得した&amp;nbsp;&lt;a href=&quot;http://api.dartlang.org/html/ElementEvents.html&quot; target=&quot;_blank&quot;&gt;ElementEvents&lt;/a&gt;&amp;nbsp;に設定します。&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/8100004623110608580/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/05/dartdom.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/8100004623110608580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/8100004623110608580'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/05/dartdom.html' title='dart:domは使えなくなります'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-5137774719878535051</id><published>2012-04-30T17:22:00.000+09:00</published><updated>2013-04-09T08:15:26.234+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dart editor"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>UbuntuのUnityランチャーへDart Editorを登録する</title><content type='html'>UbuntuのUnityランチャー（画面左側に表示されているアプリケーション ランチャー）へ Dart Editor を登録する方法です。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsmapG8n2YiCnOIq57oSooyN094sa34j6d-jXboWB4s83ZBKxsvAyTrfEJDJdbgEoC19x3J4e32yFBR5DDvisqJK_57eqqduDJL7Q6XL_t44xQn9lY3pyLAVTOtKN-zrMgHiJYbUg9oas/s1600/Screenshot+at+2012-04-30+16:48:26.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsmapG8n2YiCnOIq57oSooyN094sa34j6d-jXboWB4s83ZBKxsvAyTrfEJDJdbgEoC19x3J4e32yFBR5DDvisqJK_57eqqduDJL7Q6XL_t44xQn9lY3pyLAVTOtKN-zrMgHiJYbUg9oas/s1600/Screenshot+at+2012-04-30+16:48:26.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
現在のところLinux版のDart Editorは、debパッケージではなくzipファイルとして配布されています。そのため、そのままではUnityランチャーへ登録できません。登録するためには、.desktopファイルを用意する必要があります。&lt;br /&gt;
&lt;br /&gt;
ここでは次の環境で確認しました。
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Ubuntu 12.04&lt;/li&gt;
&lt;li&gt;Dart Editor (build 6943)&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
まず、Text Editorを起動します。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFCrNdBsOWcT-NGQ4G9C5jm_FSS_AS-73U-4_z0JXUbuc5IJw1DI8s6OHc7PMVE-qeO5kQAajRfHBMd-SmzN9Dm27hmSKvkmvo9d2HYL1bsf5nCzPV52zT96xzlnQm8qCVEbuvoGHhuzk/s1600/Screenshot+at+2012-04-30+15:23:45.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;192&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFCrNdBsOWcT-NGQ4G9C5jm_FSS_AS-73U-4_z0JXUbuc5IJw1DI8s6OHc7PMVE-qeO5kQAajRfHBMd-SmzN9Dm27hmSKvkmvo9d2HYL1bsf5nCzPV52zT96xzlnQm8qCVEbuvoGHhuzk/s320/Screenshot+at+2012-04-30+15:23:45.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
エディターに次の内容を入力ます。&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
StartupNotify=true
Icon=&lt;b&gt;Dartを展開したパス&lt;/b&gt;/icon.xpm
Name=Dart Editor
Comment=Dart IDE
Exec=&lt;b&gt;Dartを展開したパス&lt;/b&gt;/DartEditor
Categories=Development;IDE;
&lt;/pre&gt;
IconとExecに設定するパスは環境にあわせて設定してください。例えば、私の場合は /home/dart/Downloads にダウンロードしてその場所で展開しましたので、次のようになりました。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2THUUGh1g2DPpVlRStcnnqhY4eI4AQmBHMfYFj5m9UeR3jlZWEr3y_mkszX-A4zmQfNnrHNfd0ZhYXzroVDGMVtBgvYmrzXoWa0hdyPFSQ_etuk-jQJOhsl2lDhzD_ZUtZCDKE2o9vuU/s1600/Screenshot+from+2012-05-18+22:09:25.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;253&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2THUUGh1g2DPpVlRStcnnqhY4eI4AQmBHMfYFj5m9UeR3jlZWEr3y_mkszX-A4zmQfNnrHNfd0ZhYXzroVDGMVtBgvYmrzXoWa0hdyPFSQ_etuk-jQJOhsl2lDhzD_ZUtZCDKE2o9vuU/s320/Screenshot+from+2012-05-18+22:09:25.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
.desktopファイルについてより詳しくは知るには、&lt;a href=&quot;http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html&quot;&gt;Desktop Entry Specification&lt;/a&gt;&amp;nbsp;（freedesktop.org）を参照してください。&lt;br /&gt;
&lt;br /&gt;
入力できたらそのファイルを Dart Editor.desktop という名前で保存します。とりあえずDesktopに保存しましょう。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy3drsFKK4HR4rATfRtn1GWw3wGiNO6nyrNOC02j5KiPncytT2RmNGpxZmK-PkVcO4T8Og0SLqNL2ic1fbiaYXPrD2BLJ3RhRRU5JyHgAtMsrIJFibKXmT4MMa118Pu8NQEvmLgkBG1rU/s1600/Screenshot+at+2012-04-30+15:55:55.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;253&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy3drsFKK4HR4rATfRtn1GWw3wGiNO6nyrNOC02j5KiPncytT2RmNGpxZmK-PkVcO4T8Og0SLqNL2ic1fbiaYXPrD2BLJ3RhRRU5JyHgAtMsrIJFibKXmT4MMa118Pu8NQEvmLgkBG1rU/s320/Screenshot+at+2012-04-30+15:55:55.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
ただし、このままでは実行できません。実行するにはファイルの実行属性を設定する必要があります。保存したファイルを右クリックしてPropertiesを選択します。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglfmCnQq0oi2kc7fGnS3U4aWl12AIgPaGdQ3jcUam3AATmE2gJturEkEcdqUGileFWO0m_FGxctTIzd0Ns6u06p2uCN5-FILultWpFqHp3984eIdGLfMbgNCYQIe-L9SFMntqiNZLtCg8/s1600/Screenshot+at+2012-04-30+15:57:38.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglfmCnQq0oi2kc7fGnS3U4aWl12AIgPaGdQ3jcUam3AATmE2gJturEkEcdqUGileFWO0m_FGxctTIzd0Ns6u06p2uCN5-FILultWpFqHp3984eIdGLfMbgNCYQIe-L9SFMntqiNZLtCg8/s320/Screenshot+at+2012-04-30+15:57:38.png&quot; width=&quot;252&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
プロパティのPermissionsタブで、Allow executing file as program にチェックを入れます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJW-H5TxtzD3nuJeCsrFfNm16IMTtPdGXxvLjYRvMVJK8X-oIf-cpzs1jkNRgkysel4AQaWu0s3kCiAKOwB_IZWw-nzvbKEZlcGUCfIzPf5HrZzY1Z0cjHNG2lWwdbGDu9g9sJEifkq60/s1600/Screenshot+at+2012-04-30+15:57:48.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;274&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJW-H5TxtzD3nuJeCsrFfNm16IMTtPdGXxvLjYRvMVJK8X-oIf-cpzs1jkNRgkysel4AQaWu0s3kCiAKOwB_IZWw-nzvbKEZlcGUCfIzPf5HrZzY1Z0cjHNG2lWwdbGDu9g9sJEifkq60/s320/Screenshot+at+2012-04-30+15:57:48.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
これでもう一度 Dart Editor.desktop ファイルを見ると、アイコンが Dart のものに変わっていると思います。これをダブルクリックするとDart Editorが起動します。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPCWTyv5IztLja9s5aWq6fkE18QiHKsu-0_YEi-zsS2qfaXli52UuiNAE4XbY_bUO-YJ2CnYg4wCeFMbSEYvl-YdRjSiTIyflT_NhdzQ7aerIvA579jpwcdXKHwGKQNsv_d7DAxFLE_ew/s1600/Screenshot+at+2012-04-30+15:59:00.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPCWTyv5IztLja9s5aWq6fkE18QiHKsu-0_YEi-zsS2qfaXli52UuiNAE4XbY_bUO-YJ2CnYg4wCeFMbSEYvl-YdRjSiTIyflT_NhdzQ7aerIvA579jpwcdXKHwGKQNsv_d7DAxFLE_ew/s1600/Screenshot+at+2012-04-30+15:59:00.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Dart Editor.desktopファイルからDart Editorが起動できることを確認したら、Unityランチャーへ登録しましょう。まず、Dart Editor.desktopファイルを $HOME/.local/share/applications へ移動します。フォルダを開いてメニューから Go - Location... を選択するとパスが指定できますので、.local/share/applications を開きます。 applicationsがない場合は新規に作成します。ここへDart Editor.desktopを置きます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8nmnyU41iiAVAYuJ5KWR7-aZOrZeSHtBO74ao580SAsE_Nxegu6vHoBcI2pAN_Jz5BVbeOXaxjvBXtedq6AtPtZSZ10E3zVynq9KsHzVJZso4GYn8a_hpyda6tZYv7YCN2w5PDIhPdcg/s1600/Screenshot+at+2012-04-30+16:59:23.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;211&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8nmnyU41iiAVAYuJ5KWR7-aZOrZeSHtBO74ao580SAsE_Nxegu6vHoBcI2pAN_Jz5BVbeOXaxjvBXtedq6AtPtZSZ10E3zVynq9KsHzVJZso4GYn8a_hpyda6tZYv7YCN2w5PDIhPdcg/s320/Screenshot+at+2012-04-30+16:59:23.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
最後に、UnityランチャーへDart Editorを登録しましょう。 $HOME/.local/share/applications へ移動した Dart Editor.desktop を、Unityランチャーへドラッグ＆ドロップすると登録されます。Dart Editorを起動してから、Dartのアイコンを右クリックして Lock to Launcher を選択しても構いません。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiahSpjHGiekMW5MBv9SaDxeV6JlaNZwyvkmB2pRkjbgrTShhT3LCwNieBRQ8HENC3hjUbaxyCE5-NcUTXOy7jdVmnHzsfN8jIDYkNRgFcZ4_mO82bELKN6eLD1O6wyxvS-2XyOiZNjT9g/s1600/Screenshot+at+2012-04-30+16:00:19.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiahSpjHGiekMW5MBv9SaDxeV6JlaNZwyvkmB2pRkjbgrTShhT3LCwNieBRQ8HENC3hjUbaxyCE5-NcUTXOy7jdVmnHzsfN8jIDYkNRgFcZ4_mO82bELKN6eLD1O6wyxvS-2XyOiZNjT9g/s1600/Screenshot+at+2012-04-30+16:00:19.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
これでUnityランチャーからDart Editorを起動できるようになります。</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/5137774719878535051/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/04/ubuntuunitydart-editor.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/5137774719878535051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/5137774719878535051'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/04/ubuntuunitydart-editor.html' title='UbuntuのUnityランチャーへDart Editorを登録する'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsmapG8n2YiCnOIq57oSooyN094sa34j6d-jXboWB4s83ZBKxsvAyTrfEJDJdbgEoC19x3J4e32yFBR5DDvisqJK_57eqqduDJL7Q6XL_t44xQn9lY3pyLAVTOtKN-zrMgHiJYbUg9oas/s72-c/Screenshot+at+2012-04-30+16:48:26.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-1454499538688622817</id><published>2012-04-23T17:01:00.000+09:00</published><updated>2012-04-23T17:03:59.641+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="closure"/><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="fibonacci"/><title type='text'>Dartでフィボナッチ数</title><content type='html'>Dartの練習です。初期配列を与えてnacci関数を呼び出すと、そのフィボナッチ数列を返すクロージャーを返します。&lt;a href=&quot;http://try.dartlang.org/s/-bc8&quot;&gt;Dartboardで実行&lt;/a&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;nacci(List&lt;int&gt; sequence) {
  int type = sequence.length;
  return calc(int n) {
    if (sequence.length &lt; n + 1) {
      int value = 0;
      for (int i = 1; i &lt;= type; i++) {
        value += calc(n - i);
      }
      sequence.add(value);
    }
    return sequence[n];
  };
}

void main() {
  var fibo = nacci([0, 1]);
  var tri = nacci([0, 0, 1]);
  var tetra = nacci([0, 0, 0, 1]);
  var lucas = nacci([2, 1]);
  for (int i = 0; i &lt;= 10; i++) {
    print(&quot;$i : ${fibo(i)}, ${tri(i)}, ${tetra(i)}, ${lucas(i)}&quot;);
  }
}&lt;/pre&gt;
実行結果：
&lt;pre&gt;0 : 0, 0, 0, 2
1 : 1, 0, 0, 1
2 : 1, 1, 0, 3
3 : 2, 1, 1, 4
4 : 3, 2, 1, 7
5 : 5, 4, 2, 11
6 : 8, 7, 4, 18
7 : 13, 13, 8, 29
8 : 21, 24, 15, 47
9 : 34, 44, 29, 76
10 : 55, 81, 56, 123&lt;/pre&gt;
&lt;br /&gt;
参考：&lt;a href=&quot;http://ja.wikipedia.org/wiki/%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0&quot;&gt;wikipedia:フィボナッチ数&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/1454499538688622817/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/04/dart_23.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/1454499538688622817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/1454499538688622817'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/04/dart_23.html' title='Dartでフィボナッチ数'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-6002812152783301915</id><published>2012-04-23T12:55:00.000+09:00</published><updated>2012-05-16T11:38:59.833+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="double"/><category scheme="http://www.blogger.com/atom/ns#" term="int"/><category scheme="http://www.blogger.com/atom/ns#" term="num"/><category scheme="http://www.blogger.com/atom/ns#" term="string"/><title type='text'>文字列と数値を変換する</title><content type='html'>Dartで文字列（String）と数値（num）を変換するには次のようにします。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;文字列から数値を得る&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
整数（int）を得る場合は&lt;a href=&quot;http://api.dartlang.org/dart_core/Math.html#parseInt&quot; target=&quot;_blank&quot;&gt;Math.parseInt&lt;/a&gt;、小数を得る場合には &lt;a href=&quot;http://api.dartlang.org/dart_core/Math.html#parseDouble&quot; target=&quot;_blank&quot;&gt;Math.parseDouble&lt;/a&gt; を使います。&lt;a href=&quot;http://try.dartlang.org/s/XhNA&quot; target=&quot;_blank&quot;&gt;サンプルコード&lt;/a&gt;&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;main() {
  int i = Math.parseInt(&quot;123&quot;);
  double d = Math.parseDouble(&quot;1.23&quot;);
  print(&quot;i=$i, d=$d&quot;);
}&lt;/pre&gt;
変換に失敗すると&lt;a href=&quot;http://api.dartlang.org/dart_core/BadNumberFormatException.html&quot;&gt;BadNumberFormatException&lt;/a&gt;例外が発生します。&lt;br /&gt;&lt;br /&gt;
数値リテラルとして表現可能な文字列が変換可能なようですので、次のような変換もできます。&lt;a href=&quot;http://try.dartlang.org/s/rH49&quot; target=&quot;_blank&quot;&gt;サンプルコード&lt;/a&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;main() {
  // 大きな数（1e+30）
  print(Math.parseInt(&quot;1000000000000000000000000000000&quot;));
  // 16進数（10）
  print(Math.parseInt(&quot;0xA&quot;));
  // 指数表現（10）
  print(Math.parseDouble(&quot;1e+1&quot;));
}&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;数値から文字列を得る&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
単純に文字列リテラルとして、あるいは&lt;a href=&quot;http://api.dartlang.org/dart_core/Object.html#toString&quot;&gt;toString&lt;/a&gt;メソッドで変換できます。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;main() {
  int i = 1;
  print(&quot;$i, ${i.toString()}&quot;); // 1, 1
}&lt;/pre&gt;
書式を指定するにはnumクラスに用意されている次のメソッドを使います。&lt;br /&gt;&lt;br /&gt;
&lt;dt&gt;toRadixString&lt;/dt&gt;&lt;dd&gt;指定の進数の文字列&lt;/dd&gt;
&lt;dt&gt;toStringAsExponential&lt;/dt&gt;&lt;dd&gt;指定した指数値を持つ文字列&lt;/dd&gt;
&lt;dt&gt;toStringAsFixed&lt;/dt&gt;&lt;dd&gt;指定桁数の小数部を持つ文字列&lt;/dd&gt;
&lt;dt&gt;toStringAsPrecision&lt;/dt&gt;&lt;dd&gt;指定精度の文字列&lt;/dd&gt;
&lt;br /&gt;
&lt;a href=&quot;http://try.dartlang.org/s/0p88&quot; target=&quot;_blank&quot;&gt;サンプルコード&lt;/a&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  print(&quot;123=${123.toRadixString(10)}(10)&quot;); // 123(10)
  print(&quot;123=${123.toRadixString(16)}(16)&quot;); // 7b(16)
  print(&quot;123=${123.toStringAsExponential(1)}&quot;); // 1.2e+2
  print(&quot;123=${123.toStringAsExponential(2)}&quot;); // 1.23e+2
  print(&quot;123=${123.toStringAsExponential(3)}&quot;); // 1.230e+2
  print(&quot;123.45=${(123.45).toStringAsFixed(1)}&quot;); // 123.5
  print(&quot;123.45=${(123.45).toStringAsFixed(2)}&quot;); // 123.45
  print(&quot;123.45=${(123.45).toStringAsFixed(3)}&quot;); // 123.450
  print(&quot;123.45=${(123.45).toStringAsPrecision(2)}&quot;); // 1.2e+2
  print(&quot;123.45=${(123.45).toStringAsPrecision(3)}&quot;); // 123
  print(&quot;123.45=${(123.45).toStringAsPrecision(4)}&quot;); // 123.5
}&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/6002812152783301915/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/04/blog-post_23.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/6002812152783301915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/6002812152783301915'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/04/blog-post_23.html' title='文字列と数値を変換する'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-5490139519741533318</id><published>2012-04-17T09:07:00.001+09:00</published><updated>2012-04-17T09:41:46.512+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="class"/><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="interface"/><title type='text'>クラスのインターフェイスを利用する</title><content type='html'>Javaでテストコードを書いたことのある人は、次のようなコードをたくさん書いたことがあると思います。
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;// テストコードを含む典型的なJavaのコード

// インターフェイス
interface IDuck {
  void quack();
}

// 実装クラス
class Duck implements IDuck {
  void quack() { /* ... */ }
}

// テスト用のモック クラス
class MockDuck implements IDuck {
  void quack() { /* ... */ }
}&lt;/pre&gt;
本来、実装に必要なのはDuckクラスだけですが、自動テストのためにIDuckインターフェイスを作り、そこからテスト用のモック クラスを用意しています。モックを自動生成するライブラリもいくつかありますが、設定の手間が必要だったり、コードがJavaの言語仕様からみると不自然な感じになったりしてしまいます。（それでも便利ですが）&lt;br /&gt;
&lt;br /&gt;
Dartでも同じように書くことはできますが、Dartではクラスをインターフェイスとして利用できます。つまり、モックを作るためにインターフェイスを用意する必要はなく、クラスから直接モック クラスを作ることができます。&lt;a href=&quot;http://try.dartlang.org/s/Tq45&quot;&gt;サンプルコード&lt;/a&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;// 実装クラス
class Duck {
  quack() =&gt; &#39;complicated enterprise n-tier quack&#39;;
}

// テスト用のモック クラス
// Duckクラスを実装（implements）する。
class MockDuck implements Duck {
  quack() =&gt; &#39;quack for testing&#39;;
}

main() {
  Duck duck = new MockDuck();
  print(duck is Duck); // true
  print(duck.quack()); // quack for testing
}&lt;/pre&gt;
MockDuckクラスはDuckクラスを実装（implements）しています。もちろん、MockDuckではquackメソッドを実装する必要があります。&lt;br /&gt;
&lt;br /&gt;
なお、この機能は、Dartboard（&lt;a href=&quot;http://try.dartlang.org/&quot;&gt;try.dartlang.org&lt;/a&gt;）では問題なく利用できますが、現在公開されている最新のDart Editor（ビルド6479、2012/4/12公開）では&lt;a href=&quot;http://code.google.com/p/dart/issues/detail?id=1971&quot;&gt;不具合&lt;/a&gt;があるため利用できません。すでに修正されていますので次のリリースから利用できると思います。</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/5490139519741533318/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/04/blog-post.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/5490139519741533318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/5490139519741533318'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/04/blog-post.html' title='クラスのインターフェイスを利用する'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-6601604629780391817</id><published>2012-04-11T18:40:00.001+09:00</published><updated>2012-04-11T18:47:54.578+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dart editor"/><category scheme="http://www.blogger.com/atom/ns#" term="dart vm"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><title type='text'>Dartをチェックモードで動かす方法（更新版）</title><content type='html'>Dartの実行モードには、プロダクション モードとチェック モードがあります。プロダクション モードでは、変数の代入などについて型による制限はありませんが、チェック モードでは型のチェックがコンパイル時と実行時に行われます。&lt;br /&gt;
&lt;br /&gt;
開発時はチェック モードで動作させ、製品リリース後はプロダクション モードで動かす、といった使い方が想定されます。&lt;br /&gt;
&lt;br /&gt;
そのため何も指定せずにDartスクリプトを実行するとプロダクション モードで動きます。チェック モードで動かす方法は次のとおりです。&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Dart Editor&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;の場合&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;
スクリプトの実行設定画面の Run in checked mode のチェックを入れます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi04S8uyIlKC9a9JR4dMcvjiHCStn9jQidjbbzX9gdbQcSsvSVagRDq8OyH8FuxgnhYIde951w6amJ5e8ueY0yCY7HvyO_8jzmfHfgBbh9F7M6YnyJ7LW9oGBrR1E2J5bNnAAkcsJy-7Lc/s1600/darteditor2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;237&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi04S8uyIlKC9a9JR4dMcvjiHCStn9jQidjbbzX9gdbQcSsvSVagRDq8OyH8FuxgnhYIde951w6amJ5e8ueY0yCY7HvyO_8jzmfHfgBbh9F7M6YnyJ7LW9oGBrR1E2J5bNnAAkcsJy-7Lc/s320/darteditor2.png&quot; style=&quot;cursor: move;&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkQqE16cL42edwfAZ-qQk2osAoTa9icOlwxarviMLPISlp42nAC0210QRa_jndxywOistuA0CljYWnmTSCk2oVkmMhixedVjYpV8SsSD70c3JZkq8AaqgoIYU_D0h-6W04k7EnH1RL3bY/s1600/darteditor.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;231&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkQqE16cL42edwfAZ-qQk2osAoTa9icOlwxarviMLPISlp42nAC0210QRa_jndxywOistuA0CljYWnmTSCk2oVkmMhixedVjYpV8SsSD70c3JZkq8AaqgoIYU_D0h-6W04k7EnH1RL3bY/s320/darteditor.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Dartboard （&lt;a href=&quot;http://try.dartlang.org/&quot; target=&quot;_blank&quot;&gt;try.dartlang.org&lt;/a&gt;）の場合&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
画面左上にあるChecked Modeにチェックを入れます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiZE9cfSOHZ-g-nYtrjMDqDigZMssgIKID7SRnl6XACzoF2QURkzJ9PrK7t1shitlUCPCW8zk8m3Gak9y_z6fYu9pnbjhxV-fa-OM38jtZtAOkfKyv0GgUO2S1UBFhCAVCj8cgxi7gcAg/s1600/checked_mode.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiZE9cfSOHZ-g-nYtrjMDqDigZMssgIKID7SRnl6XACzoF2QURkzJ9PrK7t1shitlUCPCW8zk8m3Gak9y_z6fYu9pnbjhxV-fa-OM38jtZtAOkfKyv0GgUO2S1UBFhCAVCj8cgxi7gcAg/s1600/checked_mode.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;dart（Dart VM）の場合&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
--enable_checked_mode フラグを指定します。--enable-checked-mode や --enable_checked_mode=true でも同じです。&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-sh&quot;&gt;$ cat test.dart
main() { int a = &#39;a&#39;; }
$ dart --enable_checked_mode test.dart
Unhandled exception:
type &#39;OneByteString&#39; is not a subtype of type &#39;int&#39; of &#39;a&#39;.
 0. Function: &#39;::main&#39; url: &#39;file:///test.dart&#39; line:1 col:18
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;frogc（&amp;nbsp;Dart-to-JavaScript compiler）&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;の場合&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
デフォルトで有効になっています。&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-sh&quot;&gt;$ cat test.dart
main() { int a = &#39;a&#39;; }
$ frogc test.dart
test.dart:1:18: warning: type &quot;dart:core.String&quot; is not assignable to &quot;dart:core.int&quot;
main() { int a = &#39;a&#39;; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;^^^&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;こちらもどうぞ&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2012/03/dart_01.html&quot;&gt;Dartにおける型とモード&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2012/03/blog-post_11.html&quot;&gt;プロダクションモードとチェックモード&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2012/02/dart-vm.html&quot;&gt;Dart VMのコマンド オプション&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/6601604629780391817/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/04/dart.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/6601604629780391817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/6601604629780391817'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/04/dart.html' title='Dartをチェックモードで動かす方法（更新版）'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi04S8uyIlKC9a9JR4dMcvjiHCStn9jQidjbbzX9gdbQcSsvSVagRDq8OyH8FuxgnhYIde951w6amJ5e8ueY0yCY7HvyO_8jzmfHfgBbh9F7M6YnyJ7LW9oGBrR1E2J5bNnAAkcsJy-7Lc/s72-c/darteditor2.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-5801636185849356484</id><published>2012-04-10T21:56:00.000+09:00</published><updated>2013-05-08T13:50:05.042+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="completer"/><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="future"/><title type='text'>Dartで未来（Future）の処理を実装する</title><content type='html'>&lt;b&gt;この記事の内容は古くなっていますので、新しい解説記事を書きました（2013/5/8）&lt;/b&gt;：&lt;a href=&quot;http://dart-ing.blogspot.com/2013/05/efficientfuturem41.html&quot;&gt;Future を使いこなす&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Dartでは、「まだ受け取っていない（未来の）値をどのように処理するか」を記述することができます。&lt;br /&gt;
&lt;br /&gt;
まずは逐次型処理から考えてみましょう。ひとつの処理が終わってから次の処理を行う逐次型処理は、次のように記述できます。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  // 処理１
  // 処理２
}&lt;/pre&gt;
このプログラムは、処理１が終わってから処理２が実行されます。処理２が処理１の結果を受け取って処理される（処理２は処理１の結果に依存している）のであれば、この順で書くしかありません。たとえば次のような例が考えられます。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  double a, b;
  a = Math.random(); // 処理１
  b = a * 2; // 処理２
}&lt;/pre&gt;
このプログラムは、処理１の結果であるaの値が定まらないと、処理２の結果であるbの値も定まりません。&lt;br /&gt;
&lt;br /&gt;
ここで、処理１と処理２を別々に書きたい場合があります。つまり、例えば次のように書きたいということです。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  // 処理２
  // 処理１
}&lt;/pre&gt;
もしこのように書けるのであれば、処理１を別の関数やクラスに追い出すこともできます。しかし逐次型プログラミングではこのような書き方はできません。&lt;br /&gt;
&lt;br /&gt;
まだ計算されていない未来の結果に対して処理を記述したいという要求は、処理１が複雑だったり、処理１の途中でエラーが発生する可能性があるような場合に出てきます。たとえば通信の入出力処理と、その結果を加工するような処理です。もし複雑な処理１とそれが終わった時の処理２を別々に記述することができるのであれば、見通しのよいプログラムを書くことができます。&lt;br /&gt;
&lt;br /&gt;
このような要求はfutureと呼ばれるプログラミング パターンによって解決できます。Dartでは&lt;a href=&quot;http://api.dartlang.org/dart_core/Future.html&quot; target=&quot;_blank&quot;&gt;Future&amp;lt;T&amp;gt;&lt;/a&gt;と&lt;a href=&quot;http://api.dartlang.org/dart_core/Completer.html&quot; target=&quot;_blank&quot;&gt;Completer&amp;lt;T&amp;gt;&lt;/a&gt;でこれを実現します。&lt;a href=&quot;http://try.dartlang.org/s/YhI4&quot; target=&quot;_blank&quot;&gt;サンプルコード&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  final Completer&amp;lt;double&amp;gt; comp = new Completer&amp;lt;double&amp;gt;();
  final Future&amp;lt;double&amp;gt; fut = comp.future;
  fut.then((double a) {
    // 処理2
    double b = a * 2;
    print(&quot;b=${b}&quot;);
  });
  
  // 処理1
  double a = Math.random();
  print(&quot;a=${a}&quot;);
  comp.complete(a);
}&lt;/pre&gt;
実行例
&lt;br /&gt;
&lt;pre&gt;a=0.00013735424727201462
b=0.00027470849454402924&lt;/pre&gt;
Completer&amp;lt;T&amp;gt;の型パラメーターTは、処理が終わったあとに受け取る値の型です。Completerのfutureプロパティで、そのCompleterで処理が終わったときに呼び出されるFutureのインスタンスが取得できます。このFutureインスタンスの型パラメーターもTになります。&lt;br /&gt;
&lt;br /&gt;
処理が終わったらCompleterのcompleteメソッドを、処理結果とともに呼び出します。これによってFutureのthenメソッドに渡した関数が呼び出されます。&lt;br /&gt;
&lt;br /&gt;
Futureを用いた実装では、処理２を処理１より前に書くことができています。このまま処理１を別の関数やクラスに持っていくこともでき、呼び出し側は処理２が終わったらその結果を受け取った時の処理だけを書くことができるようになるのです。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;処理中のエラーを補足する&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
処理の途中で発生したエラー（例外）をFutureへ伝えるには、CompleterのcompleteExceptionを呼び出します。この例外はFutureのhandleExceptionメソッドで受け取ることができます。handleExceptionメソッドでtrueを返すと、そこで例外の処理が完了したことを通知します。&lt;a href=&quot;http://try.dartlang.org/s/DEA7&quot; target=&quot;_blank&quot;&gt;サンプルコード&lt;/a&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  final Completer&lt;double&gt; comp = new Completer&lt;double&gt;();
  final Future&lt;double&gt; fut = comp.future;
  fut.then((double a) {
    double b = a * 2;
    print(&quot;b=${b}&quot;);
  });
  fut.handleException((Object exception) {
    print(&quot;exception=${exception}&quot;); // exception=Error!
    return true;
  });
  
  // 処理で発生したエラーをFutureに伝える。
  comp.completeException(&quot;Error!&quot;);
}&lt;/double&gt;&lt;/double&gt;&lt;/double&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;複数のFutureの処理を続けて行う&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
２つのCompleterが存在し、それぞれ処理が終わったところでなにかの処理を順番に行わせるためには、Futureのchainメソッドを利用します。この機能を利用すると、複数のCompleterで処理を行わせ、その結果を順次処理できます。&lt;br /&gt;
&lt;br /&gt;
chainメソッドの戻り値として次に呼び出されるべきFutureを返します。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  final Completer&amp;lt;int&amp;gt; comp1 = new Completer&amp;lt;int&amp;gt;();
  final Completer&amp;lt;int&amp;gt; comp2 = new Completer&amp;lt;int&amp;gt;();

  comp1.future.chain((int a) {
    print(&quot;a=${a}&quot;);
    return comp2.future;
  }).then((int b) {
    print(&quot;b=${b}&quot;);
  });

  // comp1とcomp2のcomplete順を入れ替えても結果は同じ。
  // a=1
  // b=2
  comp1.complete(1);
  comp2.complete(2);
}&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;結果を変換するFutureを作る&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Futureのtransformメソッドを使うと、結果の値を変換して格納することができます。transformに変換処理を行う関数を渡して呼び出すと、その変換処理を伴うFutureが返ります。
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  final Completer&lt;int&gt; comp = new Completer&lt;int&gt;();

  // 単純なFuture
  comp.future.then((int a) { print(&quot;a=${a}&quot;); });

  // 変換処理を伴うFuture
  final Future tf = comp.future.transform((int a) =&amp;gt; a * 2);
  tf.then((int b) { print(&quot;b=${b}&quot;); });
  
  comp.complete(1);
}&lt;/int&gt;&lt;/int&gt;&lt;/pre&gt;
実行結果
&lt;br /&gt;
&lt;pre&gt;a=1
b=2&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;複数のFutureの結果を待つ&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
複数のFutureがすべて完了するのを待つためには&lt;a href=&quot;http://api.dartlang.org/dart_core/Futures.html&quot; target=&quot;_blank&quot;&gt;Futures&lt;/a&gt;のwaitメソッドを使います。Futureのリストを渡すと、すべてのFutureの完了を待つ新しいFutureが返りますので、そのFutureインスタンスに対してthenメソッドを呼び出します。&lt;a href=&quot;http://try.dartlang.org/s/IOo6&quot; target=&quot;_blank&quot;&gt;サンプルコード&lt;/a&gt;&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;void main() {
  final Completer&amp;lt;int&amp;gt; comp1 = new Completer&amp;lt;int&amp;gt;();
  final Completer&amp;lt;int&amp;gt; comp2 = new Completer&amp;lt;int&amp;gt;();
  
  // 複数のFutureがすべて完了するまで待つ。
  final Future&amp;lt;List&amp;lt;int&amp;gt;&amp;gt; fs =
    Futures.wait([ comp1.future, comp2.future ]);
  fs.then((List&amp;lt;int&amp;gt; results) {
    // 結果をすべて表示する。
    for (int result in results) {
      print(&quot;result=${result}&quot;);
    }
  });

  // 完了
  comp1.complete(1);
  comp2.complete(2);
}&lt;/pre&gt;
実行結果
&lt;br /&gt;
&lt;pre&gt;result=1
result=2&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Futureのプロパティ&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Futureには結果や状態を知るためのプロパティが用意されていますので、これらの動作をよく理解することがFutureを使いこなすことにつながります。&lt;br /&gt;
&lt;br /&gt;
なおここで処理中とは、completeあるいはcompleteExceptionメソッドが呼び出される前、正常終了後はcompleteメソッドが呼び出されたあと、エラー発生後はcompleteExceptionが呼び出されたあとのことです。&lt;br /&gt;
&lt;dl&gt;
&lt;dt&gt;isComplete&lt;/dt&gt;
&lt;dd&gt;処理中：false&lt;/dd&gt;
&lt;dd&gt;正常終了後：true&lt;/dd&gt;
&lt;dd&gt;エラー発生後：true&lt;/dd&gt;
&lt;dt&gt;hasValue&lt;/dt&gt;
&lt;dd&gt;処理中：false&lt;/dd&gt;
&lt;dd&gt;正常終了後：true&lt;/dd&gt;
&lt;dd&gt;エラー発生後：false&lt;/dd&gt;
&lt;dt&gt;value&lt;/dt&gt;
&lt;dd&gt;処理中：FutureNotCompleteException例外がスローされる&lt;/dd&gt;
&lt;dd&gt;正常終了後：結果の値&lt;/dd&gt;
&lt;dd&gt;エラー発生後：エラーの値（completeExceptionの引数）&lt;/dd&gt;
&lt;dt&gt;exception&lt;/dt&gt;
&lt;dd&gt;処理中：FutureNotCompleteException例外がスローされる&lt;/dd&gt;
&lt;dd&gt;正常終了後：null&lt;/dd&gt;
&lt;dd&gt;エラー発生後：エラーの値（completeExceptionの引数）&lt;/dd&gt;
&lt;/dl&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/5801636185849356484/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/04/dartfuture.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/5801636185849356484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/5801636185849356484'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/04/dartfuture.html' title='Dartで未来（Future）の処理を実装する'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-5388227458879927217</id><published>2012-04-05T09:33:00.000+09:00</published><updated>2013-04-03T18:49:14.181+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dart editor"/><category scheme="http://www.blogger.com/atom/ns#" term="dartium"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>Windows版DartiumがDart Editorに同梱されました</title><content type='html'>Dart Editorの最新版（ビルド6167）が公開され、Dart VMを搭載したWebブラウザDartiumが、Windws版Dart Editorの配布物にも同梱されるようになりました。これでLinuxやMacと同じように、Windowsでもフル機能を使った開発が行えるようになりました。&lt;br /&gt;
&lt;br /&gt;
Linux版やMac版も新しいバージョンが公開されています。すでに使われている方も、ぜひ更新して使ってみましょう。&lt;br /&gt;
&lt;br /&gt;
Dart Editorは公式サイトからダウンロードできます。&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.dartlang.org/docs/getting-started/editor/&quot;&gt;Tutorial: Dart Editor&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
ダウンロードしたファイルを展開すると、dartフォルダーの下にDartEditorの実行ファイルがありますので実行します。
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg7i5vlZ8WNRuZoeA1iC7KPywKxHocQ3UTBNENSnh1CCxuhKx91bLluCRZULMKPhxwD91GF_h5zuPfTs25PMWcvoYjnuElUVlIVU2m3sdwsjJ7fo5RLRRix-eJre3K-MEnb0AxPSNvGqA/s1600/Screenshot+at+2012-04-05+09:07:34.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;217&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg7i5vlZ8WNRuZoeA1iC7KPywKxHocQ3UTBNENSnh1CCxuhKx91bLluCRZULMKPhxwD91GF_h5zuPfTs25PMWcvoYjnuElUVlIVU2m3sdwsjJ7fo5RLRRix-eJre3K-MEnb0AxPSNvGqA/s320/Screenshot+at+2012-04-05+09:07:34.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Dart Editorのウィンドウが開きます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6g0-SuRjIq4KLBjHsZwoKqmRNeWQM98r0OlWMOLvDCwFYTuNwelv0sIkJ8NdkAk-qxqtOCG4XpPyACPNilYj83cVSScs2IZnSadp1F0W1HalOSkZ54B9nTSYgJ6u_NRkGmAGaENGLWtE/s1600/Screenshot+at+2012-04-05+09:07:10.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;224&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6g0-SuRjIq4KLBjHsZwoKqmRNeWQM98r0OlWMOLvDCwFYTuNwelv0sIkJ8NdkAk-qxqtOCG4XpPyACPNilYj83cVSScs2IZnSadp1F0W1HalOSkZ54B9nTSYgJ6u_NRkGmAGaENGLWtE/s320/Screenshot+at+2012-04-05+09:07:10.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
サンプルのClockを開いてみましょう。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibHhMfBQG0TwxEIMB_4H4ze_j0QvnPB1qhOyQGhzysLxo6Z_LB6ASe4cWYKgkJDhzymIELLtlGYy1lvKWT4C-MeloEjZgaqhHdi3slpd80jE9TXvhVZET8TFb2WQdjho4P5PXgmHzuV8s/s1600/Screenshot+at+2012-04-05+09:07:48.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;316&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibHhMfBQG0TwxEIMB_4H4ze_j0QvnPB1qhOyQGhzysLxo6Z_LB6ASe4cWYKgkJDhzymIELLtlGYy1lvKWT4C-MeloEjZgaqhHdi3slpd80jE9TXvhVZET8TFb2WQdjho4P5PXgmHzuV8s/s320/Screenshot+at+2012-04-05+09:07:48.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
ツールバーの緑の矢印ボタンで実行します。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigEi99lVawLxtknyl1_xKY69EpRjTn6vFZ40GIqPIqou9g3a4L0yhRzeOw2VPbLN5qePdVHT2s6b250QWAuwzMCMv76tMzt_agUmntYpZFdYrjOVPbhjlqOTx6vEvaGWGLGHpvbeJU5H8/s1600/Screenshot+at+2012-04-05+09:08:21.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;160&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigEi99lVawLxtknyl1_xKY69EpRjTn6vFZ40GIqPIqou9g3a4L0yhRzeOw2VPbLN5qePdVHT2s6b250QWAuwzMCMv76tMzt_agUmntYpZFdYrjOVPbhjlqOTx6vEvaGWGLGHpvbeJU5H8/s320/Screenshot+at+2012-04-05+09:08:21.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Dartiumが開いて実行されます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCNz7cFymuWwNc5Xdpfw7aXbbgHpUfYQS1MKIDJi_pMuibFuP9AtnbEFyLfR_I89vZLq35iKdsWpMza6_y8dgPBIjAzl7DofzBFrqfU5qjs6TA07XOsYQcq9tRTiW4yEiYSkL5q-YkwKI/s1600/Screenshot+at+2012-04-05+09:08:52.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;224&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCNz7cFymuWwNc5Xdpfw7aXbbgHpUfYQS1MKIDJi_pMuibFuP9AtnbEFyLfR_I89vZLq35iKdsWpMza6_y8dgPBIjAzl7DofzBFrqfU5qjs6TA07XOsYQcq9tRTiW4yEiYSkL5q-YkwKI/s320/Screenshot+at+2012-04-05+09:08:52.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Manage Launches（実行構成管理）にあるEnable debuggingのチェックボックスをチェックしてから実行すると、デバッグ実行ができます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB1cxf6AR8Mw3M9DnFqqFS4mzgnV3NW4hG_JBb6RofOHKxFkVboHZIZj6ZqNszbn8RLrcLIm7Qp4Kp2KKWkyp_r05GbPTZzTZQv2DYuZapfcWUUlSURMUMi6kNC-ugDsAhre2glmZL5No/s1600/Screenshot+at+2012-04-05+09:22:40.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;213&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB1cxf6AR8Mw3M9DnFqqFS4mzgnV3NW4hG_JBb6RofOHKxFkVboHZIZj6ZqNszbn8RLrcLIm7Qp4Kp2KKWkyp_r05GbPTZzTZQv2DYuZapfcWUUlSURMUMi6kNC-ugDsAhre2glmZL5No/s320/Screenshot+at+2012-04-05+09:22:40.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
ブレークポイントを設定してステップ実行したり、&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij44PEGnljwe2cvt9G5ADJASrCAm4FVcjzPEwy1vxrGQcabqb02AG1qBhJiDpPmZgec4qZ_kh10zwXObh76oz545Azu6vOMFxYMAemgEAyZhxMKOP_UVH-wA-GyXGt48zk3_gSr58fthw/s1600/Screenshot+at+2012-04-05+09:25:54.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;222&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij44PEGnljwe2cvt9G5ADJASrCAm4FVcjzPEwy1vxrGQcabqb02AG1qBhJiDpPmZgec4qZ_kh10zwXObh76oz545Azu6vOMFxYMAemgEAyZhxMKOP_UVH-wA-GyXGt48zk3_gSr58fthw/s320/Screenshot+at+2012-04-05+09:25:54.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
実行中のコードにある変数の値を見ることもできます。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5COOsJBb5OR8KJpXqnXmPC7t-z2wW_dzkup-AcGhgnK56rinOdlJQT4avOZcMMznlz16ziTbcwoyw2y2arA1DMrvXFiAfQwx38QptdTblA8rmch6ClmAaxWVdjMiQvf8XhsKcPia3ywA/s1600/Screenshot+at+2012-04-05+09:28:02.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5COOsJBb5OR8KJpXqnXmPC7t-z2wW_dzkup-AcGhgnK56rinOdlJQT4avOZcMMznlz16ziTbcwoyw2y2arA1DMrvXFiAfQwx38QptdTblA8rmch6ClmAaxWVdjMiQvf8XhsKcPia3ywA/s320/Screenshot+at+2012-04-05+09:28:02.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
どうでしょうか。とても便利に使える開発環境になってきたと思います。&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/5388227458879927217/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/04/windowsdartiumdart-editor.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/5388227458879927217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/5388227458879927217'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/04/windowsdartiumdart-editor.html' title='Windows版DartiumがDart Editorに同梱されました'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg7i5vlZ8WNRuZoeA1iC7KPywKxHocQ3UTBNENSnh1CCxuhKx91bLluCRZULMKPhxwD91GF_h5zuPfTs25PMWcvoYjnuElUVlIVU2m3sdwsjJ7fo5RLRRix-eJre3K-MEnb0AxPSNvGqA/s72-c/Screenshot+at+2012-04-05+09:07:34.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-3799155436128377393</id><published>2012-04-04T08:43:00.000+09:00</published><updated>2012-04-04T08:43:59.060+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dart editor"/><category scheme="http://www.blogger.com/atom/ns#" term="dartium"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>DartiumのWindows版がダウンロードできるようになっています</title><content type='html'>Dart VMを搭載したChromiumブラウザの&lt;b&gt;Dartium&lt;/b&gt;ですが今まではLinux版とMac版だけが公開されていて、Windowsで利用するには自分でソースコードからビルドする必要がありました。&lt;br /&gt;
&lt;br /&gt;
最近になって、Windows版のDartiumもバイナリーがビルドされるようになり、公式サイトからダウンロードできるようになっています。&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.dartlang.org/dartium/&quot; target=&quot;_blank&quot;&gt;Chromium with the Dart VM&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-kTx2hr8fD7fjY9zEgxf8lp4QegmjWaWVzmHoWc28Swrc5SviBSdz-q_xomtlE82jOrdv2UD7JjBRe_5R3_nQnY7l84HSuEkA2JL8_BLQvCksx2w3UMmP16rFQpW2EX9jakkOJ9wd3jg/s1600/Chromium_Windows.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;224&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-kTx2hr8fD7fjY9zEgxf8lp4QegmjWaWVzmHoWc28Swrc5SviBSdz-q_xomtlE82jOrdv2UD7JjBRe_5R3_nQnY7l84HSuEkA2JL8_BLQvCksx2w3UMmP16rFQpW2EX9jakkOJ9wd3jg/s320/Chromium_Windows.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
少し確認した限りでは、半月ほど前と比べて格段に安定して動くようになっています。&lt;br /&gt;
&lt;br /&gt;
現時点ではDartium単体でダウンロードできるものの、Dartの開発環境であるDart EditorのWindows版にはDartiumは同梱されていません。しかし&lt;a href=&quot;http://gsdview.appspot.com/dart-editor-archive-continuous/latest/&quot; target=&quot;_blank&quot;&gt;ナイトリービルド&lt;/a&gt;ではすでに同梱されるようになっていますので、近いうちにリリース版がダウンロードできるようになるでしょう。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu7TTUga5V7JDub5hJ4elqG3FaiOHiUxUwytyYmf5JShs_Xf5xZlao_QJGKMkArWda5MzmthFqZcXHuC2eef_MOl9s0MmDrWS9Qdy9TyVUeds6cL444sDuQyfXT8pPIvQwMgPiLbXBcLQ/s1600/Chromium_Windows2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;136&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu7TTUga5V7JDub5hJ4elqG3FaiOHiUxUwytyYmf5JShs_Xf5xZlao_QJGKMkArWda5MzmthFqZcXHuC2eef_MOl9s0MmDrWS9Qdy9TyVUeds6cL444sDuQyfXT8pPIvQwMgPiLbXBcLQ/s320/Chromium_Windows2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/3799155436128377393/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/04/dartiumwindows.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/3799155436128377393'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/3799155436128377393'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/04/dartiumwindows.html' title='DartiumのWindows版がダウンロードできるようになっています'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-kTx2hr8fD7fjY9zEgxf8lp4QegmjWaWVzmHoWc28Swrc5SviBSdz-q_xomtlE82jOrdv2UD7JjBRe_5R3_nQnY7l84HSuEkA2JL8_BLQvCksx2w3UMmP16rFQpW2EX9jakkOJ9wd3jg/s72-c/Chromium_Windows.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-3296730683122529236</id><published>2012-03-21T09:18:00.000+09:00</published><updated>2012-03-21T09:18:20.588+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dart editor"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><title type='text'>新しいDart Editor（ビルド5549）が公開されています</title><content type='html'>新しいDart Editor（ビルド5549）が公開されています。&lt;br /&gt;
&lt;br /&gt;
ダウンロードはこちらから。&lt;br /&gt;
&lt;a href=&quot;http://www.dartlang.org/docs/getting-started/editor/&quot; target=&quot;_blank&quot;&gt;Tutorial: Dart Editor : Dart : Structured web programming&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
FileビューでDartのライブラリが参照できるようになっています。以前のLibraryビューのように使えるようになりました。&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEDvvzyukByWB1f8Bkj8CBvW5JLZOMudX9y8P9GIaxlxvZURDZTf3XK9kOKyDnJgxwtZGjbc4ygs7bEbEviiBIGoSdDZ98I51lGrliLUCRHcLQHay_4qbW51Hkd_6YymGiFQNKRrxoIHc/s1600/Screenshot+at+2012-03-21+09:12:56.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEDvvzyukByWB1f8Bkj8CBvW5JLZOMudX9y8P9GIaxlxvZURDZTf3XK9kOKyDnJgxwtZGjbc4ygs7bEbEviiBIGoSdDZ98I51lGrliLUCRHcLQHay_4qbW51Hkd_6YymGiFQNKRrxoIHc/s320/Screenshot+at+2012-03-21+09:12:56.png&quot; width=&quot;197&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/3296730683122529236/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/03/dart-editor5549.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/3296730683122529236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/3296730683122529236'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/03/dart-editor5549.html' title='新しいDart Editor（ビルド5549）が公開されています'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEDvvzyukByWB1f8Bkj8CBvW5JLZOMudX9y8P9GIaxlxvZURDZTf3XK9kOKyDnJgxwtZGjbc4ygs7bEbEviiBIGoSdDZ98I51lGrliLUCRHcLQHay_4qbW51Hkd_6YymGiFQNKRrxoIHc/s72-c/Screenshot+at+2012-03-21+09:12:56.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-8370690414127061873</id><published>2012-03-18T10:31:00.001+09:00</published><updated>2012-04-04T08:45:34.703+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartium"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>DartiumのWindows版ビルド済みバイナリが公開されています</title><content type='html'>Dart VMを搭載したWebブラウザDartiumのWindows版ビルド済みバイナリが公開されています。MacOS X版とLinux版のバイナリはすでに公開されていましたが、これでWindowsでも気軽に試せるようになります。&lt;br /&gt;
&lt;br /&gt;
今確認したところでは公式ページの &lt;a href=&quot;http://www.dartlang.org/dartium/&quot;&gt;Chromium with the Dart VM&lt;/a&gt; からはまだダウンロードできませんが、そのうちダウンロードできるようになるでしょう。現時点ではこちらからダウンロードできます。&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://gsdview.appspot.com/dartium-archive/continuous/&quot;&gt;http://gsdview.appspot.com/dartium-archive/continuous/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;追記&lt;/b&gt;&lt;br /&gt;
まだおかしいですね。一応実行まではできましたが簡単にクラッシュしてしまいますし、公式ページからダウンロードできるようになるまでもう少し待ったほうがいいかもしれません。&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUU8A3Ba-qpeO4FdSMGeR4V1SRf-yJuI3bsj815wN5sX15pYPoeuxaN3IFRwUNTN4xKYcgmVxlujwrSB3da1l2s3SjsVN6tzgvnviuU256Dam9_lV7W3l65jKTziggSdS33QzNHnODym0/s1600/Screenshot+at+2012-03-18+10:38:57.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;205&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUU8A3Ba-qpeO4FdSMGeR4V1SRf-yJuI3bsj815wN5sX15pYPoeuxaN3IFRwUNTN4xKYcgmVxlujwrSB3da1l2s3SjsVN6tzgvnviuU256Dam9_lV7W3l65jKTziggSdS33QzNHnODym0/s320/Screenshot+at+2012-03-18+10:38:57.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;こちらもどうぞ&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.jp/2012/04/dartiumwindows.html&quot;&gt;DartiumのWindows版がダウンロードできるようになっています&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/8370690414127061873/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/03/dartiumwindows.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/8370690414127061873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/8370690414127061873'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/03/dartiumwindows.html' title='DartiumのWindows版ビルド済みバイナリが公開されています'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUU8A3Ba-qpeO4FdSMGeR4V1SRf-yJuI3bsj815wN5sX15pYPoeuxaN3IFRwUNTN4xKYcgmVxlujwrSB3da1l2s3SjsVN6tzgvnviuU256Dam9_lV7W3l65jKTziggSdS33QzNHnODym0/s72-c/Screenshot+at+2012-03-18+10:38:57.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-1090260403771999738</id><published>2012-03-16T15:12:00.000+09:00</published><updated>2012-03-16T15:12:29.677+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dart editor"/><category scheme="http://www.blogger.com/atom/ns#" term="string"/><title type='text'>新しいDart Editor（ビルド5427）が公開されています</title><content type='html'>新しいDart Editor（ビルド5427）が公開されています。&lt;br /&gt;
&lt;br /&gt;
ダウンロードはこちらから。&lt;br /&gt;
&lt;a href=&quot;http://www.dartlang.org/docs/getting-started/editor/&quot; target=&quot;_blank&quot;&gt;Tutorial: Dart Editor : Dart : Structured web programming&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
隣り合った文字列の連結ができるようになっています。&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;main() {
  String abcdef = &#39;abc&#39; &#39;def&#39;;
  String html = &quot;&amp;lt;p&amp;gt;&quot;
                &quot;  &amp;lt;em&amp;gt;Hello&amp;lt;/em&amp;gt;&quot;
                &quot;  &amp;lt;i&amp;gt;World&amp;lt;/i&amp;gt;&quot;
                &quot;&amp;lt;/p&amp;gt;&quot;;
}&lt;/pre&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl-wRFJqxJOtykshfonlRI_q_Y_M82XqDkgV7Rmol6Cry0s3swoC3MluEbEPhPw_kJImdKPRxmUQcRNM6hdqexpR8YoGu4qZ9yc6FbDu7Z60IZ91O4BA74prXqSy5y5fLxfydcm2CzkCo/s1600/Screenshot+at+2012-03-16+15:00:08.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;230&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl-wRFJqxJOtykshfonlRI_q_Y_M82XqDkgV7Rmol6Cry0s3swoC3MluEbEPhPw_kJImdKPRxmUQcRNM6hdqexpR8YoGu4qZ9yc6FbDu7Z60IZ91O4BA74prXqSy5y5fLxfydcm2CzkCo/s320/Screenshot+at+2012-03-16+15:00:08.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
そのほかの変更点や詳細はDart News &amp;amp; Updatesの記事を参照して下さい。
&lt;a href=&quot;http://news.dartlang.org/2012/03/new-dart-editor-builds-supports.html&quot;&gt;New Dart Editor builds supports adjacent string literals&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;こちらもどうぞ&lt;/b&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2012/03/dart_09.html&quot;&gt;Dartで文字列を連結する&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/1090260403771999738/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/03/dart-editor5427.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/1090260403771999738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/1090260403771999738'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/03/dart-editor5427.html' title='新しいDart Editor（ビルド5427）が公開されています'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl-wRFJqxJOtykshfonlRI_q_Y_M82XqDkgV7Rmol6Cry0s3swoC3MluEbEPhPw_kJImdKPRxmUQcRNM6hdqexpR8YoGu4qZ9yc6FbDu7Z60IZ91O4BA74prXqSy5y5fLxfydcm2CzkCo/s72-c/Screenshot+at+2012-03-16+15:00:08.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-1462718451876433300</id><published>2012-03-13T12:40:00.000+09:00</published><updated>2012-03-13T12:42:46.645+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="get"/><category scheme="http://www.blogger.com/atom/ns#" term="getter"/><category scheme="http://www.blogger.com/atom/ns#" term="set"/><category scheme="http://www.blogger.com/atom/ns#" term="setter"/><title type='text'>Dartにおけるゲッター（get）とセッター（set）</title><content type='html'>Dartではクラスのメンバーにgetとset（いわゆるゲッターとセッター）を定義することができます。ゲッターとセッターで定義されたメンバーは、あたかもメンバー変数と同じようにアクセスできますが、変数への代入だけではなく、ほかの処理を追加することもできます。&lt;br /&gt;
&lt;br /&gt;
ゲッターとセッターはメソッドと同じような形で、戻り値の方の後にgetあるいはsetを付けます。
ゲッターは仮引数を持たず、適切な値を返します。セッターは適切な仮引数を1つ持ち、値は返しません。
アクセスするときには、メンバー変数へアクセスするときと同じ方法で参照できます。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;class Line {
  Line(this.start, this.end);
  int start, end;
  int &lt;b&gt;get&lt;/b&gt; length() =&gt; end - start;
  void &lt;b&gt;set&lt;/b&gt; length(int len) {
    end = start + len;
  }
}

main() {
  Line line = new Line(1, 3);

  // ほかのメンバー変数（line.startなど）と同じ方法で参照できる。
  // 出力： (1, 3) : length=2
  print(&#39;(${line.start}, ${line.end}) : length=${&lt;b&gt;line.length&lt;/b&gt;}&#39;);

  // メンバー変数と同じ方法で代入もできる。
  &lt;b&gt;line.length = 5;&lt;/b&gt;

  // 出力： (1, 6) : length=5
  print(&#39;(${line.start}, ${line.end}) : length=${line.length}&#39;);
}&lt;/pre&gt;
この例のように同じ名前のゲッターとセッターを1つのクラス内で定義することができます。しかし同じ名前のメンバー変数やメソッドを持つことはできません。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;class Line1 {
  int &lt;b&gt;length&lt;/b&gt;;
  int get &lt;b&gt;length&lt;/b&gt;() =&gt; /* ... */; // エラー！
}

class Line2 {
  int &lt;b&gt;length&lt;/b&gt;() { /* ... */ }
  int get &lt;b&gt;length&lt;/b&gt;() =&gt; /* ... */ ; // エラー！
}&lt;/pre&gt;
このような場合には、メンバー変数をプライベートにする（_lengthにする）と良いでしょう。&lt;br /&gt;
&lt;br /&gt;
また、ゲッターとセッターはオーバーライドすることができません。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;class Line {
  int get &lt;b&gt;length&lt;/b&gt;() =&gt; /* ... */;
  String get &lt;b&gt;length&lt;/b&gt;() =&gt; /* ... */; // エラー！
}&lt;/pre&gt;
ゲッターとセッターの定義の前にstaticを付けると、静的なゲッターとセッターを定義することもできます。
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;こちらもどうぞ&lt;/b&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2012/03/dart_07.html&quot;&gt;Dartの関数宣言と呼び出し&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dart-ing.blogspot.com/2012/03/dart_3202.html&quot;&gt;Dartでクラスや変数の見え方を制御する&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/1462718451876433300/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/03/dartgetset.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/1462718451876433300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/1462718451876433300'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/03/dartgetset.html' title='Dartにおけるゲッター（get）とセッター（set）'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7408950498410688785.post-8196782195431467391</id><published>2012-03-12T12:41:00.000+09:00</published><updated>2012-03-12T12:41:53.108+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="dart"/><category scheme="http://www.blogger.com/atom/ns#" term="dartlang"/><category scheme="http://www.blogger.com/atom/ns#" term="function"/><category scheme="http://www.blogger.com/atom/ns#" term="typedef"/><title type='text'>Dartで関数型のエイリアスを使う</title><content type='html'>Dartではtypedefで型のエイリアス（別名）を定義できます。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;// 「num型の引数を2つ受け取りbool型の値を返す」関数型のエイリアス
typedef bool Comparator(num, num);

void func(Comparator c) {
  // 処理
}

main() {
  Comparator c = (a, b) =&gt; a &gt; b;
  func(c);
}&lt;/pre&gt;
typedefによって定義されたエイリアスも型ですので、isによる型の判定ができます。
&lt;pre class=&quot;prettyprint lang-dart&quot;&gt;print(c is Comparator); // true&lt;/pre&gt;
ただし現時点では関数型だけに使えます。今後は他の型でも使えるようになるかもしれません。</content><link rel='replies' type='application/atom+xml' href='http://dart-ing.blogspot.com/feeds/8196782195431467391/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://dart-ing.blogspot.com/2012/03/dart_12.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/8196782195431467391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7408950498410688785/posts/default/8196782195431467391'/><link rel='alternate' type='text/html' href='http://dart-ing.blogspot.com/2012/03/dart_12.html' title='Dartで関数型のエイリアスを使う'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>