Variables and Data Types in Dart

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 giv…


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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Variables and Data Types in Dart." Baransel | Sciencx - Friday August 20, 2021, https://www.scien.cx/2021/08/20/variables-and-data-types-in-dart/
HARVARD
Baransel | Sciencx Friday August 20, 2021 » Variables and Data Types in Dart., viewed ,<https://www.scien.cx/2021/08/20/variables-and-data-types-in-dart/>
VANCOUVER
Baransel | Sciencx - » Variables and Data Types in Dart. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/08/20/variables-and-data-types-in-dart/
CHICAGO
" » Variables and Data Types in Dart." Baransel | Sciencx - Accessed . https://www.scien.cx/2021/08/20/variables-and-data-types-in-dart/
IEEE
" » Variables and Data Types in Dart." Baransel | Sciencx [Online]. Available: https://www.scien.cx/2021/08/20/variables-and-data-types-in-dart/. [Accessed: ]
rf:citation
» Variables and Data Types in Dart | Baransel | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.