Dart
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
]
開始行:
「[[.NET 開発基盤部会 Wiki>http://dotnetdevelopmentinfras...
-戻る
--[[Flutter]]
--[[JavaScript]]
*目次 [#f2f9c42d]
#contents
*概要 [#p891f2e1]
一応、[[AltJS>JavaScript#d11cd6c3]]([[Flutter]]専用言語...
-Googleによって開発されたウェブ向けのプログラミング言語
-普及は進まず、2015年にはVMのChrome統合を断念
-[[TypeScript>JavaScript#kf4fe370]]をGoogle社内の標準プロ...
-しかし、2018年2月に発表された[[Dart]]2&[[Flutter]]が進...
-JavaScriptへのトランスパイラ以外にVMも持っている([[Flut...
*詳細 [#o066888e]
**基本 [#raa002e9]
***エントリポイント [#m8892128]
void main() {
print("Hello, World!");
}
***型 [#jeb5ec86]
-基本型~
int、double、num、bool、Null、String
-配列
--List:一次元配列
--Set:ユニークな値の一次元配列
--Map:連想配列
-その他
--Generic型
--dynamic型
-型変換~
.toString()など。
-[[Null Safety>Flutterのセカンド・ステップ#cf4abd0d]]
***変数 [#p6d7f386]
-自動型推論~
varを使用できる。
-変数宣言キーワード
--const:定数
--final:変数だが初期化時以外の代入不可
-命名規則
--変数:lowerCamelCase
--[[クラス>#y7fa3c0b]]:UpperCamelCase
***関数 [#g7d00fc5]
-定義
<戻り値の型> <関数名>([<引数の型> <引数値>],[<引数の指定...
return <戻り値>;
}
--public / private
---private~
関数名の先頭を「_」にする。
---public~
privateでなければ、publicになる。
--instance / static
---static~
staticを付与する。
---instance~
staticでなければ、instanceになる。
--戻り値
---型の省略
helloWorld2(world){
return 'Hello $world';
}
---非同期
Future<void> ...() async {
...
}
-引数
--名前付き引数~
"{}"内に定義する。
computeSum({int val1, int val2}){
return val1 + val2;
}
--オプショナル引数~
---オーバーロードは無いのでコレで対応できない場合はリネー...
---"[]"内に定義して、nullを許容しないものには初期値を指定。
List<String> splitString(String input, [String split = '...
// 省略
}
-ラムダ式~
$はプレースホルダ
--ワンライナー(右辺に式
String helloWorld4(String world) => 'Hello $world';
--無名関数(右辺にコードブロック(クロージャ
String helloWorld4(String world) { 'Hello $world'; };
***クラス [#y7fa3c0b]
-new演算子~
インスタンスの作成のnew演算子は省略可能
-インターフェイス(抽象クラス)~
クラス定義にabstractキーワードを使用する。
-継承
--具象クラス:extendsキーワードを利用して継承
--抽象クラス:implementsキーワードを利用して継承
-メンバ変数
--先頭が「_」から始まるモノは、Internal相当。
--Flutterではthisは省略されることが多い。
-メソッド
--オーバーライドはできる。
--オーバーロードはできない。
--ミックスインと言うメソッド追加の仕組みがある。
---mixinキーワードを利用してクラス風に定義して、
---withキーワードを利用して多重継承っぽく使用できる。
---中から使う場合は、thisではなくsuperを使用するらしい。
-コンストラクタ
--略記の形式が幾つかある。
--名前付きコンストラクタ
--リダイレクト・コンストラクタ
--Factoryコンストラクタ
---抽象クラスで派生クラスを返したり
---シングルトンで返したりできる。
-ゲッター・セッター
String _name;
set name(String value){
_name = value;
}
String get name{
return _name;
}
**library [#r510b1a9]
-libraryで名前をつけられる。
-libraryを明示しなくても自動的に~
タグがつけられてライブラリとして扱われる。
-dart:で始まるライブラリと、~
package:で始まるその他のライブラリがある。
***part / part of [#tb7422da]
partとpart ofでlibraryのファイル分割が可能。
***import / export [#d4b67c0a]
-import
--ライブラリを読み込む
--同じパッケージ内のライブラリ(≒ファイル)
---パッケージ名のlib以下の仮想パスで指定。
import 'package:my_package/src/other_library.dart';
---自ファイルからの相対パスで指定。
import 'src/other_library.dart';
import '../other_library.dart';
-export
--外部に公開するライブラリを指定する。
--メインのライブラリにexportを記述すると、~
メインのライブラリを読み込むだけで、~
exportされたライブラリにアクセスできる。
***show / hide / as / deferred [#o49ea970]
オプション
-show
--import / exportで利用可能。
--指定したクラスや関数のみを参照
-hide
--import / exportで利用可能。
--指定したクラスや関数を参照しない
-as
--importでのみ利用可能。
--指定したクラスに別名を指定
--C#のusing エイリアス(別名) ディレクティブ的な。
-deferred
--importでのみ利用可能。
--deferred asで、エイリアス利用時まで遅延ロード
**非同期処理 [#fd139055]
***Futureクラス [#s1e50693]
[[Promise (JavaScript)]]とほぼ同様
***async/await [#j9e0c84f]
[[async/await (JavaScript)]]とほぼ同様
**その他 [#dce86cf5]
***Stream [#cf67cccf]
-[[LINQ>https://techinfoofmicrosofttech.osscons.jp/index....
-RxDart~
≒[[Reactive Extensions(Rx)>https://techinfoofmicrosoftt...
***スプレッド演算子(...) [#e270f6c0]
-配列またはオブジェクトの要素を展開する。
-[[ECMAScriptにもあるヤツ。>ECMAScript#ca4641e1]]
*参考 [#s5d00218]
-Dart - Wikipedia~
https://ja.wikipedia.org/wiki/Dart
-Dart programming language | Dart~
https://dart.dev/#try-dart
**Publickey [#if7c08d8]
-グーグルから「JavaScriptは根本的な問題を抱えている」との...
https://www.publickey1.jp/blog/11/javascript_6.html
-グーグル、新言語「Dart」を発表。~
JavaScriptのようなWebプログラミングを想定~
https://www.publickey1.jp/blog/11/dartjavascriptweb.html
-Googleの新言語「Dart」、ECMAが標準化を開始~
https://www.publickey1.jp/blog/13/googledartecma.html
-ChromeへのDartVM統合を断念、Dart開発チームが発表。~
今後はJavaScriptへのコンパイルにフォーカス~
https://www.publickey1.jp/blog/15/chromedartvmdart.html
-Google社内の標準言語としてTypeScriptが承認される。ng-con...
https://www.publickey1.jp/blog/17/googletypescriptng-conf...
-TypeScriptが標準言語になっても、~
Dartのことは忘れてませんよとGoogle担当者がフォロー~
https://www.publickey1.jp/blog/17/typescriptdartgoogle.html
-Googleが「Dart 2」発表、Dartを再起動。~
iOS/Android用ライブラリ「Flutter」と共に~
Webとモバイルのクライアント開発にフォーカス~
https://www.publickey1.jp/blog/18/googledart_2dartiosandr...
-人気が下降しプログラマの求人も少ないプログラミング言語ワ...
一方で仕事の多い言語は? CodementorXとCoding Dojoの調査結...
https://www.publickey1.jp/blog/18/5_codementorxcoding_doj...
**CodeZine(コードジン) [#o97ca32b]
-Flutterで始めるモバイルアプリ開発連載一覧~
https://codezine.jp/article/corner/830
--Flutter開発で必要なDart言語の基本を理解しよう~
https://codezine.jp/article/detail/13498
--Flutter開発で使うDart言語での関数・クラスの使い方を理解...
https://codezine.jp/article/detail/13586
--Dart言語でのプログラム設計でワンランク上を目指そう~
https://codezine.jp/article/detail/13665
**adventar.org [#b2006741]
すぐにFlutterを始めたい人のためのDart入門
-前編~
https://itome.team/blog/2019/12/flutter-advent-calendar-d...
-後編~
https://itome.team/blog/2019/12/flutter-advent-calendar-d...
**DevelopersIO [#b18aa83e]
-Dart逆引きリファレンス~
https://dev.classmethod.jp/articles/dart_reference_index/
--導入(Getting started)~
https://dev.classmethod.jp/etc/dart_reference_getting_sta...
--コードのモジュール化(Code modularity)~
https://dev.classmethod.jp/client-side/dart_reference_cod...
--変数(Variables)~
https://dev.classmethod.jp/client-side/dart_reference_var...
--コレクション(Collections)~
https://dev.classmethod.jp/client-side/dart_reference_col...
--文字列(Strings)~
https://dev.classmethod.jp/client-side/dart_reference_str...
--真偽値(Booleans)~
https://dev.classmethod.jp/client-side/dart_reference_boo...
--関数(Functions)~
https://dev.classmethod.jp/client-side/dart_reference_fun...
--反復処理(Iterators)~
https://dev.classmethod.jp/client-side/dart_reference_ite...
--クラス(Classes)~
https://dev.classmethod.jp/client-side/dart_reference_cla...
--DOM要素の問い合せ(Finding elements in DOM)~
https://dev.classmethod.jp/client-side/dart_reference_fin...
--DOMの操作(Manipulating DOM)~
https://dev.classmethod.jp/client-side/dart_reference_man...
--正規表現(Regular expressions)~
https://dev.classmethod.jp/client-side/dart_reference_reg...
--例外(Exceptions)~
https://dev.classmethod.jp/client-side/dart_reference_exc...
--イベントハンドリング(Event handling)~
https://dev.classmethod.jp/client-side/dart_reference_eve...
--タイミング(Timing)~
https://dev.classmethod.jp/client-side/dart_reference_tim...
--HTML属性(HTML attributes)~
https://dev.classmethod.jp/client-side/dart_reference_htm...
--CSSクラス(CSS Classes)~
https://dev.classmethod.jp/client-side/dart_reference_css...
--Ajax~
https://dev.classmethod.jp/client-side/dart_reference_ajax/
--jQuery~
https://dev.classmethod.jp/client-side/dart_reference_jqu...
--数値処理(Math)~
https://dev.classmethod.jp/client-side/dart_reference_math/
--実行時プログラム操作(Run time program manipulation)~
...
終了行:
「[[.NET 開発基盤部会 Wiki>http://dotnetdevelopmentinfras...
-戻る
--[[Flutter]]
--[[JavaScript]]
*目次 [#f2f9c42d]
#contents
*概要 [#p891f2e1]
一応、[[AltJS>JavaScript#d11cd6c3]]([[Flutter]]専用言語...
-Googleによって開発されたウェブ向けのプログラミング言語
-普及は進まず、2015年にはVMのChrome統合を断念
-[[TypeScript>JavaScript#kf4fe370]]をGoogle社内の標準プロ...
-しかし、2018年2月に発表された[[Dart]]2&[[Flutter]]が進...
-JavaScriptへのトランスパイラ以外にVMも持っている([[Flut...
*詳細 [#o066888e]
**基本 [#raa002e9]
***エントリポイント [#m8892128]
void main() {
print("Hello, World!");
}
***型 [#jeb5ec86]
-基本型~
int、double、num、bool、Null、String
-配列
--List:一次元配列
--Set:ユニークな値の一次元配列
--Map:連想配列
-その他
--Generic型
--dynamic型
-型変換~
.toString()など。
-[[Null Safety>Flutterのセカンド・ステップ#cf4abd0d]]
***変数 [#p6d7f386]
-自動型推論~
varを使用できる。
-変数宣言キーワード
--const:定数
--final:変数だが初期化時以外の代入不可
-命名規則
--変数:lowerCamelCase
--[[クラス>#y7fa3c0b]]:UpperCamelCase
***関数 [#g7d00fc5]
-定義
<戻り値の型> <関数名>([<引数の型> <引数値>],[<引数の指定...
return <戻り値>;
}
--public / private
---private~
関数名の先頭を「_」にする。
---public~
privateでなければ、publicになる。
--instance / static
---static~
staticを付与する。
---instance~
staticでなければ、instanceになる。
--戻り値
---型の省略
helloWorld2(world){
return 'Hello $world';
}
---非同期
Future<void> ...() async {
...
}
-引数
--名前付き引数~
"{}"内に定義する。
computeSum({int val1, int val2}){
return val1 + val2;
}
--オプショナル引数~
---オーバーロードは無いのでコレで対応できない場合はリネー...
---"[]"内に定義して、nullを許容しないものには初期値を指定。
List<String> splitString(String input, [String split = '...
// 省略
}
-ラムダ式~
$はプレースホルダ
--ワンライナー(右辺に式
String helloWorld4(String world) => 'Hello $world';
--無名関数(右辺にコードブロック(クロージャ
String helloWorld4(String world) { 'Hello $world'; };
***クラス [#y7fa3c0b]
-new演算子~
インスタンスの作成のnew演算子は省略可能
-インターフェイス(抽象クラス)~
クラス定義にabstractキーワードを使用する。
-継承
--具象クラス:extendsキーワードを利用して継承
--抽象クラス:implementsキーワードを利用して継承
-メンバ変数
--先頭が「_」から始まるモノは、Internal相当。
--Flutterではthisは省略されることが多い。
-メソッド
--オーバーライドはできる。
--オーバーロードはできない。
--ミックスインと言うメソッド追加の仕組みがある。
---mixinキーワードを利用してクラス風に定義して、
---withキーワードを利用して多重継承っぽく使用できる。
---中から使う場合は、thisではなくsuperを使用するらしい。
-コンストラクタ
--略記の形式が幾つかある。
--名前付きコンストラクタ
--リダイレクト・コンストラクタ
--Factoryコンストラクタ
---抽象クラスで派生クラスを返したり
---シングルトンで返したりできる。
-ゲッター・セッター
String _name;
set name(String value){
_name = value;
}
String get name{
return _name;
}
**library [#r510b1a9]
-libraryで名前をつけられる。
-libraryを明示しなくても自動的に~
タグがつけられてライブラリとして扱われる。
-dart:で始まるライブラリと、~
package:で始まるその他のライブラリがある。
***part / part of [#tb7422da]
partとpart ofでlibraryのファイル分割が可能。
***import / export [#d4b67c0a]
-import
--ライブラリを読み込む
--同じパッケージ内のライブラリ(≒ファイル)
---パッケージ名のlib以下の仮想パスで指定。
import 'package:my_package/src/other_library.dart';
---自ファイルからの相対パスで指定。
import 'src/other_library.dart';
import '../other_library.dart';
-export
--外部に公開するライブラリを指定する。
--メインのライブラリにexportを記述すると、~
メインのライブラリを読み込むだけで、~
exportされたライブラリにアクセスできる。
***show / hide / as / deferred [#o49ea970]
オプション
-show
--import / exportで利用可能。
--指定したクラスや関数のみを参照
-hide
--import / exportで利用可能。
--指定したクラスや関数を参照しない
-as
--importでのみ利用可能。
--指定したクラスに別名を指定
--C#のusing エイリアス(別名) ディレクティブ的な。
-deferred
--importでのみ利用可能。
--deferred asで、エイリアス利用時まで遅延ロード
**非同期処理 [#fd139055]
***Futureクラス [#s1e50693]
[[Promise (JavaScript)]]とほぼ同様
***async/await [#j9e0c84f]
[[async/await (JavaScript)]]とほぼ同様
**その他 [#dce86cf5]
***Stream [#cf67cccf]
-[[LINQ>https://techinfoofmicrosofttech.osscons.jp/index....
-RxDart~
≒[[Reactive Extensions(Rx)>https://techinfoofmicrosoftt...
***スプレッド演算子(...) [#e270f6c0]
-配列またはオブジェクトの要素を展開する。
-[[ECMAScriptにもあるヤツ。>ECMAScript#ca4641e1]]
*参考 [#s5d00218]
-Dart - Wikipedia~
https://ja.wikipedia.org/wiki/Dart
-Dart programming language | Dart~
https://dart.dev/#try-dart
**Publickey [#if7c08d8]
-グーグルから「JavaScriptは根本的な問題を抱えている」との...
https://www.publickey1.jp/blog/11/javascript_6.html
-グーグル、新言語「Dart」を発表。~
JavaScriptのようなWebプログラミングを想定~
https://www.publickey1.jp/blog/11/dartjavascriptweb.html
-Googleの新言語「Dart」、ECMAが標準化を開始~
https://www.publickey1.jp/blog/13/googledartecma.html
-ChromeへのDartVM統合を断念、Dart開発チームが発表。~
今後はJavaScriptへのコンパイルにフォーカス~
https://www.publickey1.jp/blog/15/chromedartvmdart.html
-Google社内の標準言語としてTypeScriptが承認される。ng-con...
https://www.publickey1.jp/blog/17/googletypescriptng-conf...
-TypeScriptが標準言語になっても、~
Dartのことは忘れてませんよとGoogle担当者がフォロー~
https://www.publickey1.jp/blog/17/typescriptdartgoogle.html
-Googleが「Dart 2」発表、Dartを再起動。~
iOS/Android用ライブラリ「Flutter」と共に~
Webとモバイルのクライアント開発にフォーカス~
https://www.publickey1.jp/blog/18/googledart_2dartiosandr...
-人気が下降しプログラマの求人も少ないプログラミング言語ワ...
一方で仕事の多い言語は? CodementorXとCoding Dojoの調査結...
https://www.publickey1.jp/blog/18/5_codementorxcoding_doj...
**CodeZine(コードジン) [#o97ca32b]
-Flutterで始めるモバイルアプリ開発連載一覧~
https://codezine.jp/article/corner/830
--Flutter開発で必要なDart言語の基本を理解しよう~
https://codezine.jp/article/detail/13498
--Flutter開発で使うDart言語での関数・クラスの使い方を理解...
https://codezine.jp/article/detail/13586
--Dart言語でのプログラム設計でワンランク上を目指そう~
https://codezine.jp/article/detail/13665
**adventar.org [#b2006741]
すぐにFlutterを始めたい人のためのDart入門
-前編~
https://itome.team/blog/2019/12/flutter-advent-calendar-d...
-後編~
https://itome.team/blog/2019/12/flutter-advent-calendar-d...
**DevelopersIO [#b18aa83e]
-Dart逆引きリファレンス~
https://dev.classmethod.jp/articles/dart_reference_index/
--導入(Getting started)~
https://dev.classmethod.jp/etc/dart_reference_getting_sta...
--コードのモジュール化(Code modularity)~
https://dev.classmethod.jp/client-side/dart_reference_cod...
--変数(Variables)~
https://dev.classmethod.jp/client-side/dart_reference_var...
--コレクション(Collections)~
https://dev.classmethod.jp/client-side/dart_reference_col...
--文字列(Strings)~
https://dev.classmethod.jp/client-side/dart_reference_str...
--真偽値(Booleans)~
https://dev.classmethod.jp/client-side/dart_reference_boo...
--関数(Functions)~
https://dev.classmethod.jp/client-side/dart_reference_fun...
--反復処理(Iterators)~
https://dev.classmethod.jp/client-side/dart_reference_ite...
--クラス(Classes)~
https://dev.classmethod.jp/client-side/dart_reference_cla...
--DOM要素の問い合せ(Finding elements in DOM)~
https://dev.classmethod.jp/client-side/dart_reference_fin...
--DOMの操作(Manipulating DOM)~
https://dev.classmethod.jp/client-side/dart_reference_man...
--正規表現(Regular expressions)~
https://dev.classmethod.jp/client-side/dart_reference_reg...
--例外(Exceptions)~
https://dev.classmethod.jp/client-side/dart_reference_exc...
--イベントハンドリング(Event handling)~
https://dev.classmethod.jp/client-side/dart_reference_eve...
--タイミング(Timing)~
https://dev.classmethod.jp/client-side/dart_reference_tim...
--HTML属性(HTML attributes)~
https://dev.classmethod.jp/client-side/dart_reference_htm...
--CSSクラス(CSS Classes)~
https://dev.classmethod.jp/client-side/dart_reference_css...
--Ajax~
https://dev.classmethod.jp/client-side/dart_reference_ajax/
--jQuery~
https://dev.classmethod.jp/client-side/dart_reference_jqu...
--数値処理(Math)~
https://dev.classmethod.jp/client-side/dart_reference_math/
--実行時プログラム操作(Run time program manipulation)~
...
ページ名: