1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Dartの型について

Last updated at Posted at 2020-11-18

Dartの型の種類

  • int → 整数
  • double → 小数
  • String → 文字
  • bool → 真偽値

型推論について

  • var(let) → 自動で型推論してくれる
  • dynamic → 何型でも良い
  • final → 後から変更できない
  • const → 後から変更できない(コンパイル時に値が決まる)

var (let)

var a = 100;
aは数値になる

a = 'あああ'
文字列を入れようとするとエラーになる

daynamic

dynamic b = 100;

b = 200;
b = 'こんにちは';

エラーにならない

final

final c = 100;

c = 200;
エラーになる

const

const d = 100;

d = 300;
エラーになる

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?