Dart for beginners
Step one to become a flutter Developer
Okay, The step one is learning Dart and understanding dart, So once we step into flutter it will be much easier.
part-2 -Basic operation of Array in dart
Hope this blog will help to know about basic of dart or help to recall it
Dart is static language.
1. Always with main()
In Dart main() is important, without void main()
our code will not run.
Free advise : use
dartpad.dev
for running dart
Always start with
2. Fight with semicolon;
The developer’s enemy (semicolon) comes with dart, So don’t forget to put semicolon(;) at the end always
so just print
to print the statements
3. Declaring (war) variables
3.1 normal type
3.2 Type inference. And also we can declare as var,
dart will automatically get the data type by assigned value.
3.3 Final, final is like declaring variable only for read (we can’t rewrite)
3.4 const , same like final. advantage is compile time constant and using const is best practice
3.5 Dynamic, it can be any data type and also we can change the data type like
This is how we declare variables in dart
Free advise, don’t get confuse. take a breath
Note: we can use single (‘’) or double (“”)quotes for string
4. concat in dart
This is joining two variables into one.
same like for int and other variables
5. String fun
so to print $
we use \
in front
and \n
for new line
And for multiline use """
"""
To upper case
To lower case
Contains in dart
contains will return bool value.
contains('The string we want to check')
isEmpty
.isNotEmpty
is opposite for isEmpty
replaceAll
Int into string
To String As Fixed
like 1.2345 into 1.23 or 1.234
String into double
.round
like 1.322 into 1
and also
6.Ternary access operator
its simple dimple
name == 'tj'
so we get jesuraj
otherwise it will be wilson
Covered some dart basics in this blogs.
To know about arrays in dart click here
If any mistake or you need to shout me, comments session in always opened
other blogs - arrays in dart
நன்றி வணக்கம் || Thank you