A variable is a name to allocate memory, where the user stores the data and it can be accessed whenever requires, with the help of a variable by calling the declared variable name. There are different types of variables that are used to assign or store the data. The type of the variable depends upon the type which we're going to store or use.
One point we should consider while declaring a variable is, Whenever any initial value of a variable is not declared, It is assumed to be null no matter what kind of data type it is.
Dart Uses var as a keyword while declaring a variable.
Ex var name = 'Aditya';
Declaring a keyword is not allowed
Space between characters is not allowed
The name of the variable can't begin with a number
It can be alphanumeric
Special characters are not allowed except Underscore ( _ ) & Dollar( $ )
String
Integer
double
Booleans
Collections
final & const
Note: Float is not available in dart it is replaced with a double.
The sequence of characters, which uses for declaring a text. Strings in dart can be multiple or single lines. A string can be declared in double or single quotes.
// this is a single quote declaration
String singleQuote = 'Aditya';
// this is a double quote declaration
String doubleQuote = "Aditya";
most of the time we go with a single quote declaration.
for combining a string we can use the + operator,
Ex String a = 'Learn';
String b = ' to win';
String c = a+b;
print(c);
Here is the result
// Learn to win
For declaring numerical's other than decimal numbers we use Integer (int) as the data type
Ex
int a = 5;
int b = 3;
print('Summation of a & b is.....${a+b}');
// Output: Summation of a & b is.....8
Declaring of decimal numbers can be handled via a double.
Ex
double a = 5.2;
double b = 3.3;
print('Multiplication of a & b is.....${a*b}');
// Output: Multiplication of a & b is.....17.16
For applying a condition we use booleans. it supports two types of literals they are true and false. it can be declared as bool
Ex
bool var_true = true;
bool var_false = false;
For Collections please refer to this page for detailed elaboration.
https://www.aditya.win/learn-flutter/dart-programming/collections