Flutter for Beginners
上QQ阅读APP看书,第一时间看更新

Built-in types

Dart is a type-safe programming language, so types are mandatory for variables. Although types are mandatory, type annotations are optional, which means that you don't need to specify the type of a variable when declaring it. Dart performs type inference, and we will examine more of this in the Type inference – bringing dynamism to the show section.

Here are the built-in data types in Dart:

  • Numbers (such as num, int, and double)
  • Booleans (such as bool)
  • Collections (such as lists, arrays, and maps)
  • Strings and runes (for expressing Unicode characters in a string)