Flutter Day : 3 Introduction to Dart
Introduction to Dart

Flutter Day : 3 Introduction to Dart



Dart :

Dart is a client-optimized programming language for apps on multiple platforms. It is developed by Google and is used to build mobile, desktop, server, and web applications. Dart is an object-oriented, class-based, garbage-collected language with C-style syntax. Dart can compile to either native code or JavaScript.


Data type :

In computer science and computer programming, a data type or simply type is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support basic data types of integer numbers, Floating-point numbers, characters and Booleans.

The variables in the dart can be defined as their "data type" or keyword "var"

No alt text provided for this image

This example shows that a is an integer type variable so that it only contain numbers not strings.

No alt text provided for this image

If a variable is define with the keyword "var" it automatically get the datatype by its own here it is shown by the example.

No alt text provided for this image

List is a collection data type. It allows multiple values to be stored within the same field. In Table Design, you must configure the List data type with all the values that the field stores.

The variable which contain more than one values that is known as the list of that similar data type

No alt text provided for this image

The variable which contain more than one values but having different data types is known as the list of that "object" data type , below is the example of the list of object type.

No alt text provided for this image

If the ;list has been declared by the keyword "List" it has been changed to the dynamic list

No alt text provided for this image

If a list is declared with the generic "<...>" then it only supports that data type only , otherwise it generates an error.

No alt text provided for this image

If it contains similar data type as the generic has declared it runs without error.

No alt text provided for this image

When you need to set the index of the values by your own you need to use the map , In the map the variable contain value by the index of the keys.

here the "name" is the key and "nik" is t

No alt text provided for this image

Functions and procedures are the basic building blocks of programs. They are small sections of code that are used to perform a particular task, and they are used for two main reasons. The first reason is that they can be used to avoid repetition of commands within the program.

Here , nik() is the parameterized function which is used to print the given values while it has been called in the main() function

No alt text provided for this image

Here , nik() is the parameterized function which is used to add the given values while it has been called in the main() function

No alt text provided for this image

Here nik() is the function which return the output of the function where it has been called into the main() function after adding the values.

No alt text provided for this image

Here to optimize the code and reduce the complexity the function is written into the different file and imported to the main file where the function is call for getting the sum of the numbers

No alt text provided for this image

Android :

Here the runApp() is the function from where the android app starts , MaterialApp is the function which is used to give the pre-created UI for the app. center is also a function which adjust the text and widget position ,and the Text() is the function for printing text on screen.

No alt text provided for this image


要查看或添加评论,请登录

Nikhil Suryawanshi的更多文章

社区洞察

其他会员也浏览了