This content originally appeared on DEV Community and was authored by Baransel
In addition to general data types such as String, integer, we use different; We will talk about 2 important data types.
- var
- dynamic
The var
data type does not have a specific value. We can assign any variable we want, it doesn't matter. You can give a string or an integer value if you wish, to the variable defined by var
. You can see examples below.
var name = 'Baransel Arslan';
var age = 20;
var message = 'Welcome! $name';
var message2 = 'Welcome! ${name.toUpperCase()}';
The dynamic
data type has a mutable structure. We can define the variable we created with dynamic
in the first string data type and then assign an integer
value to the same variable. Of course, I use this string
and integer
example all the time because they are the most common variable types. Variables such as double
, bool
can also be used.
dynamic variable = 'Baransel Arslan';
variable = 20;
Follow my blog for more baransel.dev.
This content originally appeared on DEV Community and was authored by Baransel

Baransel | Sciencx (2021-08-20T11:38:42+00:00) Variables and Data Types in Dart. Retrieved from https://www.scien.cx/2021/08/20/variables-and-data-types-in-dart/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.