| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
631 バイト追加 、 2021年8月3日 (火) 16:08
==null安全==
*https://medium.com/flutterworld/flutter-null-safety-5d20012c2441
*https://gaprot.jp/2021/04/27/flutter-sound-null-safety/
 
*ver2.1.2 から型レベルでnull安全を導入
<pre>
final String country = null; // nullを代入できない
final String? country = null; // nullを代入できる
</pre>
 
===Non Nullable Type===
----
*変数に ! を付けることで、その変数が NULL ではないことをコンパイラに伝え、安全に使用できる
<pre>
void main() {
String? country = "USA";
String myCountry = country!; // myCountry は null不許可 country が null の場合はエラーとなる
}
</pre>
==ジェネリクス==

案内メニュー