Search⌘ K
AI Features

Data Types

Data types in Dart define the kind of information a variable can hold, with all data types being treated as objects. Variables store references to these objects rather than the actual values. Dart supports core data types like Numbers, Strings, and Booleans, as well as collections such as Lists and Maps. Literals are fixed values directly written in code, while modern Dart enforces null safety, requiring non-nullable types to be initialized before use, and allowing nullable types with a question mark. Understanding these concepts ensures stable and predictable programming in Dart.

What are data types?

The data type of an item or variable is an attribute that tells us what kind of data that variable can have.

Data types can be found all around us; numbers, alphabets, or characters which are classified based on the similar properties they share.

Dart’s built-in data types

The Dart language has special support for the following types:

  • Numbers
  • Strings
  • Booleans
  • Lists
  • Sets
  • Maps
  • Runes
  • Symbols
svg viewer

The focus of this ...