SlideShare une entreprise Scribd logo
1  sur  61
Télécharger pour lire hors ligne
Dart language
By TechnoShip Cell Geci
Dart Programming Language
● Open-Source General-Purpose programming language.
● Developed by Google.
● This meant for the server as well as the browser.
● an object-oriented language.
● C-style syntax.
Designed By
Lars Bak and Kasper Lund
Why Dart?
Help app developers
write complex, high
fidelity client apps for
the modern web.
Dart v/s javaScript
Where Dart Using?
● Flutter Created on top of Dart.
● Flutter has an Power Full Engine to
perform smooth and lag less
performance.
● Flutter used for:
Going deep into
First Dart Program
// Entry point to Dart program
main() {
print('Hello from Dart');
}
• main() - The special, required, top-level function where app execution starts.
• Every app must have a top-level main() function, which serves as the entry
point to the app.
Comments In Dart
• Dart supports both single line and multi line comments
// Single line comment
/* This is
an example
of multi line
comment */
Built in Types
• number
• int - Integer (range -253 to 253)
• double - 64-bit (double-precision)
• string
• boolean – true and false
• symbol
• Collections
• list (arrays)
• map
• set
• runes (for expressing Unicode characters in a string)
Variable Initializing
● var name=”technoship”;
● var reg=123;
var keyword used to create static variables.
● dynamic name=”technoship”;
● dynamic reg=123;
dynamic keyword used to create dynamic variables.
● String name=”technoship”;
● int reg=123;
Variables can initialize using its data type.
List and Map
● List
List names=<String>[“Arun”,”Alen”];
List is used to store same data type items
● Map
Map rollno_name=<int,String>{1:”Arun”,2:”Alen”};
Map is an object that associates keys and values
String Interpolation
● Identifiers could be added within a string literal using $identifier or
$varaiable_name syntax.
var user = 'Bill';
var city = 'Bangalore';
print("Hello $user. Are you from $city?");
// prints Hello Bill. Are you from Bangalore?
● You can put the value of an expression inside a string by using ${expression}
print('3 + 5 = ${3 + 5}'); // prints 3 + 5 = 8
Operators in
Operands and operator
● An expression is a special kind of statement that evaluates to a value.
● Every expression is composed of −
○ Operands − Represents the data
○ Operator − Defines how the operands will be processed to produce a
value.
● Consider the following expression – "2 + 3". In this expression, 2 and 3 are
operands and the symbol "+" (plus) is the operator.
operators that are available in Dart.
● Arithmetic Operators
● Equality and Relational Operators
● Type test Operators
● Bitwise Operators
● Assignment Operators
● Logical Operators
Arithmetic Operators
Arithmetic Operators(cont..)
Equality and Relational Operators
Type test Operators
Bitwise Operators
Assignment Operators
Assignment Operators(cont..)
Logical Operators
Control flow statements
● if and else
● for loops (for and for in)
● while and do while loops
● break and continue
● switch and case
if and else
● if and else
var age = 17;
if(age >= 18){
print('you can vote');
}
else{
print('you can not vote');
}
● curly braces { } could be omitted when the blocks have a single line of code
Conditional Expressions
● Dart has two operators that let you evaluate expressions that might otherwise
require ifelse statements −
○ condition ? expr1 : expr2
● If condition is true, then the expression evaluates expr1 (and returns its value);
otherwise, it evaluates and returns the value of expr2.
● Eg:
○ var res = 10 > 12 ? "greater than 10":"lesser than or equal to 10";
● expr1 ?? expr2
● If expr1 is non-null, returns its value; otherwise, evaluates and returns the
value of expr2
else if
● Supports else if as expected
var income = 75;
if (income <= 50){
print('tax rate is 10%');
}
else if(income >50 && income <80){
print('tax rate is 20%');
}
else{
print('tax rate is 30%');
}
While & do..while
● While in dart
var num=0;
while(num<5){
print(num);
i=i+1;
}
● do..while in dart
var num=0;
do{
print(num);
i=i+1;
}while(num<5);
for loops
● Supports standard for loop (as
supported by other languages
that follow C like syntax)
for(int ctr=0; ctr<5; ctr++){
print(ctr);
}
● Iterable classes such as List and
Set also support the for-in form of
iteration
var cities=['Kolkata','Bangalore'];
for(var city in cities){
print(city);
}
switch case
● Switch statements compare integer, string, or compile-time constants
● Enumerated types work well in switch statements
● Supports empty case clauses, allowing a form of fall-through
var window_state = 'Closing';
switch(window_state){
case 'Opening' : print('Window is opening');
Break;
case 'Closing' : print('Window is Closing');
break;
default:print(“Non of the options”);
Functions in
Implementing a function
● Syntax
Return_type function function_name(parameters_list){
Function body;
}
● Eg:
Bool isOne(int a){
if(a==0){
return 0;
}
return 1;
}
Lambda function
● Syntax
[return_type]function_name(parameters)=>expression;
● Eg:
printMsg()=>print("hello");
int test()=>1234;
Parameters types
● Named Parameters
● Optional Parameters
● Default Parameters
Named Parameters
● eg:
Function definition :
void enableFlags({bool bold, bool hidden}) {...}
Function call:
enableFlags(bold: true, hidden: false);
Optional Parameters
● Wrapping a set of function parameters in [ ] marks them as optional positional
parameters:
● Eg:
Function definition :
void enableFlags(bool bold, [bool hidden]) {...}
Default Parameters
● Your function can use = to define default values for both named and
positional parameters.
● The default values must be compile-time constants.
● default value is provided, the default value is null.
● Eg:
void enableFlags({bool bold = false, bool hidden = false}) {...}
Exceptions in
Exception
● Exceptions are errors indicating that something unexpected happened.
● When an Exception occurs the normal flow of the program is disrupted and
the program/Application terminates abnormally.
● Eg
var n=10~/0;
Output:
Error occured ZeroDivision.
The try / on / catch Blocks
● syntax
try {
// code that might throw an exception
}
on Exception1 {
// code for handling exception
}
catch Exception2 {
// code for handling exception
}finally {
// code that should always execute; irrespective of the exception
}
Example try / on / catch
● try {
res = 10 ~/ 0;
}
on IntegerDivisionByZeroException
{
print('Cannot divide by zero');
}
● try {
res = 10 ~/ 0;
}
catch(e) {
print(e);
}
Exceptions in dart
Throw
● The throw keyword is used to explicitly raise an exception.
● A raised exception should be handled to prevent the program from exiting
abruptly.
● The syntax for raising an exception explicitly is −
throw new Exception_name();
Eg : of Throws
main() {
try {
test_age(-2);
}
catch(e) {
print('Age cannot be negative');
}
}
void test_age(int age) {
if(age<0) {
throw new FormatException();
}
}
object oriented programming
concepts(oop)
OOPs (Object-Oriented Programming System)
● Object means a real-world entity such as a pen, chair, table, computer, watch,
etc.
● Object-Oriented Programming is a methodology or paradigm to design a
program using classes and objects.
● It simplifies software development and maintenance by providing some
concepts:-
○ Object
○ Class
○ Inheritance
○ Polymorphism
○ Abstraction
○ Encapsulation
Object
● Any entity that has state and behavior is known as an object. For example, a
chair, pen, table, keyboard, bike, etc. It can be physical or logical.
● An Object can be defined as an instance of a class.
● An object contains an address and takes up some space in memory.
● Objects can communicate without knowing the details of each other's data or
code.
● Example: A dog is an object because it has states like color, name, breed, etc.
as well as behaviors like wagging the tail, barking, eating, etc.
Class
● Collection of objects is called class. It is a logical entity.
● A class can also be defined as a blueprint from which you can create an
individual object. Class doesn't consume any space.
Inheritance
● When one object acquires all the properties and behaviors of a parent object,
it is known as inheritance.
● It provides code reusability.
● It is used to achieve runtime polymorphism.
● Types of inheritance:-
○ Single Inheritance
○ Multiple Inheritance
○ Hierarchical Inheritance
○ Multilevel Inheritance
○ Hybrid Inheritance (also known as Virtual Inheritance)
Polymorphism
● If one task is performed in different ways, it is known as polymorphism.
● For example: to convince the customer differently, to draw something, for
example, shape, triangle, rectangle, etc.
● Another example can be to speak something; for example, a cat speaks
meow, dog barks woof, etc.
Abstraction
● Hiding internal details and showing functionality is known as abstraction.
● For example phone call, we don't know the internal processing.
Encapsulation
● Binding (or wrapping) code and data together into a single unit are known as
encapsulation.
● For example, a capsule, it is wrapped with different medicines.
OOP in
Declaring a Class in dart
● Use the class keyword to declare a class in Dart.
● A class definition starts with the keyword class followed by the class name;
● The class body enclosed by a pair of curly braces.
● Syntax
class class_name {
<fields>
<getters/setters>
<constructors>
<functions>
}
A class definition can include the following −
● Fields − A field is any variable declared in a class. Fields represent data
pertaining to objects.
● Setters and Getters − Allows the program to initialize and retrieve the values
of the fields of a class. A default getter/ setter is associated with every class.
However, the default ones can be overridden by explicitly defining a setter/
getter.
●
Thank You..
PPT created by Vishnu Suresh

Contenu connexe

Tendances

Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDKdigitaljoni
 
The magic of flutter
The magic of flutterThe magic of flutter
The magic of flutterShady Selim
 
Introduction to Flutter
Introduction to FlutterIntroduction to Flutter
Introduction to FlutterApoorv Pandey
 
Pune Flutter Presents - Flutter 101
Pune Flutter Presents - Flutter 101Pune Flutter Presents - Flutter 101
Pune Flutter Presents - Flutter 101Arif Amirani
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastBartosz Kosarzycki
 
What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?Sergi Martínez
 
Flutter presentation.pptx
Flutter presentation.pptxFlutter presentation.pptx
Flutter presentation.pptxFalgunSorathiya
 
Getting started with flutter
Getting started with flutterGetting started with flutter
Getting started with flutterrihannakedy
 
Building beautiful apps using google flutter
Building beautiful apps using google flutterBuilding beautiful apps using google flutter
Building beautiful apps using google flutterAhmed Abu Eldahab
 

Tendances (20)

Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDK
 
Flutter
FlutterFlutter
Flutter
 
Flutter workshop
Flutter workshopFlutter workshop
Flutter workshop
 
The magic of flutter
The magic of flutterThe magic of flutter
The magic of flutter
 
Introduction to Flutter
Introduction to FlutterIntroduction to Flutter
Introduction to Flutter
 
Flutter introduction
Flutter introductionFlutter introduction
Flutter introduction
 
Dart Programming.pptx
Dart Programming.pptxDart Programming.pptx
Dart Programming.pptx
 
Pune Flutter Presents - Flutter 101
Pune Flutter Presents - Flutter 101Pune Flutter Presents - Flutter 101
Pune Flutter Presents - Flutter 101
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
 
What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?
 
Flutter
FlutterFlutter
Flutter
 
Flutter presentation.pptx
Flutter presentation.pptxFlutter presentation.pptx
Flutter presentation.pptx
 
Introduction to flutter
Introduction to flutter Introduction to flutter
Introduction to flutter
 
Flutter
FlutterFlutter
Flutter
 
Linguagem Dart (Google)
Linguagem Dart (Google)Linguagem Dart (Google)
Linguagem Dart (Google)
 
Flutter
Flutter Flutter
Flutter
 
Flutter Intro
Flutter IntroFlutter Intro
Flutter Intro
 
Getting started with flutter
Getting started with flutterGetting started with flutter
Getting started with flutter
 
Building beautiful apps using google flutter
Building beautiful apps using google flutterBuilding beautiful apps using google flutter
Building beautiful apps using google flutter
 
Hello Flutter
Hello FlutterHello Flutter
Hello Flutter
 

Similaire à Dart workshop

Washington Practitioners Significant Changes To Rpc 1.5
Washington Practitioners Significant Changes To Rpc 1.5Washington Practitioners Significant Changes To Rpc 1.5
Washington Practitioners Significant Changes To Rpc 1.5Oregon Law Practice Management
 
Paulo Freire Pedagpogia 1
Paulo Freire Pedagpogia 1Paulo Freire Pedagpogia 1
Paulo Freire Pedagpogia 1Alejandra Perez
 
Jerry Shea Resume And Addendum 5 2 09
Jerry  Shea Resume And Addendum 5 2 09Jerry  Shea Resume And Addendum 5 2 09
Jerry Shea Resume And Addendum 5 2 09gshea11
 
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi PetangMajlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi PetangImsamad
 
Agapornis Mansos - www.criadourosudica.blogspot.com
Agapornis Mansos - www.criadourosudica.blogspot.comAgapornis Mansos - www.criadourosudica.blogspot.com
Agapornis Mansos - www.criadourosudica.blogspot.comAntonio Silva
 
Dart PPT.pptx
Dart PPT.pptxDart PPT.pptx
Dart PPT.pptxDSCMESCOE
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scaladatamantra
 
Engineering Student MuleSoft Meetup#6 - Basic Understanding of DataWeave With...
Engineering Student MuleSoft Meetup#6 - Basic Understanding of DataWeave With...Engineering Student MuleSoft Meetup#6 - Basic Understanding of DataWeave With...
Engineering Student MuleSoft Meetup#6 - Basic Understanding of DataWeave With...Jitendra Bafna
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing TutorialMahira Banu
 
Meetup C++ A brief overview of c++17
Meetup C++  A brief overview of c++17Meetup C++  A brief overview of c++17
Meetup C++ A brief overview of c++17Daniel Eriksson
 
Presentation 2nd
Presentation 2ndPresentation 2nd
Presentation 2ndConnex
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++Manzoor ALam
 

Similaire à Dart workshop (20)

Programming basics
Programming basicsProgramming basics
Programming basics
 
Python ppt
Python pptPython ppt
Python ppt
 
MMBJ Shanzhai Culture
MMBJ Shanzhai CultureMMBJ Shanzhai Culture
MMBJ Shanzhai Culture
 
Washington Practitioners Significant Changes To Rpc 1.5
Washington Practitioners Significant Changes To Rpc 1.5Washington Practitioners Significant Changes To Rpc 1.5
Washington Practitioners Significant Changes To Rpc 1.5
 
Paulo Freire Pedagpogia 1
Paulo Freire Pedagpogia 1Paulo Freire Pedagpogia 1
Paulo Freire Pedagpogia 1
 
Jerry Shea Resume And Addendum 5 2 09
Jerry  Shea Resume And Addendum 5 2 09Jerry  Shea Resume And Addendum 5 2 09
Jerry Shea Resume And Addendum 5 2 09
 
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi PetangMajlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
Majlis Persaraan Pn.Hjh.Normah bersama guru-guru Sesi Petang
 
Agapornis Mansos - www.criadourosudica.blogspot.com
Agapornis Mansos - www.criadourosudica.blogspot.comAgapornis Mansos - www.criadourosudica.blogspot.com
Agapornis Mansos - www.criadourosudica.blogspot.com
 
LoteríA Correcta
LoteríA CorrectaLoteríA Correcta
LoteríA Correcta
 
Dart PPT.pptx
Dart PPT.pptxDart PPT.pptx
Dart PPT.pptx
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
 
Cs3430 lecture 15
Cs3430 lecture 15Cs3430 lecture 15
Cs3430 lecture 15
 
Engineering Student MuleSoft Meetup#6 - Basic Understanding of DataWeave With...
Engineering Student MuleSoft Meetup#6 - Basic Understanding of DataWeave With...Engineering Student MuleSoft Meetup#6 - Basic Understanding of DataWeave With...
Engineering Student MuleSoft Meetup#6 - Basic Understanding of DataWeave With...
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
 
Meetup C++ A brief overview of c++17
Meetup C++  A brief overview of c++17Meetup C++  A brief overview of c++17
Meetup C++ A brief overview of c++17
 
C++ theory
C++ theoryC++ theory
C++ theory
 
Presentation 2nd
Presentation 2ndPresentation 2nd
Presentation 2nd
 
02 functions, variables, basic input and output of c++
02   functions, variables, basic input and output of c++02   functions, variables, basic input and output of c++
02 functions, variables, basic input and output of c++
 
Oops lecture 1
Oops lecture 1Oops lecture 1
Oops lecture 1
 
Software Developer Training
Software Developer TrainingSoftware Developer Training
Software Developer Training
 

Dernier

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 

Dernier (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 

Dart workshop

  • 1.
  • 2.
  • 4. Dart Programming Language ● Open-Source General-Purpose programming language. ● Developed by Google. ● This meant for the server as well as the browser. ● an object-oriented language. ● C-style syntax.
  • 5. Designed By Lars Bak and Kasper Lund
  • 6. Why Dart? Help app developers write complex, high fidelity client apps for the modern web.
  • 8. Where Dart Using? ● Flutter Created on top of Dart. ● Flutter has an Power Full Engine to perform smooth and lag less performance. ● Flutter used for:
  • 10. First Dart Program // Entry point to Dart program main() { print('Hello from Dart'); } • main() - The special, required, top-level function where app execution starts. • Every app must have a top-level main() function, which serves as the entry point to the app.
  • 11. Comments In Dart • Dart supports both single line and multi line comments // Single line comment /* This is an example of multi line comment */
  • 12. Built in Types • number • int - Integer (range -253 to 253) • double - 64-bit (double-precision) • string • boolean – true and false • symbol • Collections • list (arrays) • map • set • runes (for expressing Unicode characters in a string)
  • 13. Variable Initializing ● var name=”technoship”; ● var reg=123; var keyword used to create static variables. ● dynamic name=”technoship”; ● dynamic reg=123; dynamic keyword used to create dynamic variables. ● String name=”technoship”; ● int reg=123; Variables can initialize using its data type.
  • 14. List and Map ● List List names=<String>[“Arun”,”Alen”]; List is used to store same data type items ● Map Map rollno_name=<int,String>{1:”Arun”,2:”Alen”}; Map is an object that associates keys and values
  • 15. String Interpolation ● Identifiers could be added within a string literal using $identifier or $varaiable_name syntax. var user = 'Bill'; var city = 'Bangalore'; print("Hello $user. Are you from $city?"); // prints Hello Bill. Are you from Bangalore? ● You can put the value of an expression inside a string by using ${expression} print('3 + 5 = ${3 + 5}'); // prints 3 + 5 = 8
  • 17. Operands and operator ● An expression is a special kind of statement that evaluates to a value. ● Every expression is composed of − ○ Operands − Represents the data ○ Operator − Defines how the operands will be processed to produce a value. ● Consider the following expression – "2 + 3". In this expression, 2 and 3 are operands and the symbol "+" (plus) is the operator.
  • 18. operators that are available in Dart. ● Arithmetic Operators ● Equality and Relational Operators ● Type test Operators ● Bitwise Operators ● Assignment Operators ● Logical Operators
  • 27. Control flow statements ● if and else ● for loops (for and for in) ● while and do while loops ● break and continue ● switch and case
  • 28. if and else ● if and else var age = 17; if(age >= 18){ print('you can vote'); } else{ print('you can not vote'); } ● curly braces { } could be omitted when the blocks have a single line of code
  • 29. Conditional Expressions ● Dart has two operators that let you evaluate expressions that might otherwise require ifelse statements − ○ condition ? expr1 : expr2 ● If condition is true, then the expression evaluates expr1 (and returns its value); otherwise, it evaluates and returns the value of expr2. ● Eg: ○ var res = 10 > 12 ? "greater than 10":"lesser than or equal to 10"; ● expr1 ?? expr2 ● If expr1 is non-null, returns its value; otherwise, evaluates and returns the value of expr2
  • 30. else if ● Supports else if as expected var income = 75; if (income <= 50){ print('tax rate is 10%'); } else if(income >50 && income <80){ print('tax rate is 20%'); } else{ print('tax rate is 30%'); }
  • 31. While & do..while ● While in dart var num=0; while(num<5){ print(num); i=i+1; } ● do..while in dart var num=0; do{ print(num); i=i+1; }while(num<5);
  • 32. for loops ● Supports standard for loop (as supported by other languages that follow C like syntax) for(int ctr=0; ctr<5; ctr++){ print(ctr); } ● Iterable classes such as List and Set also support the for-in form of iteration var cities=['Kolkata','Bangalore']; for(var city in cities){ print(city); }
  • 33. switch case ● Switch statements compare integer, string, or compile-time constants ● Enumerated types work well in switch statements ● Supports empty case clauses, allowing a form of fall-through var window_state = 'Closing'; switch(window_state){ case 'Opening' : print('Window is opening'); Break; case 'Closing' : print('Window is Closing'); break; default:print(“Non of the options”);
  • 35. Implementing a function ● Syntax Return_type function function_name(parameters_list){ Function body; } ● Eg: Bool isOne(int a){ if(a==0){ return 0; } return 1; }
  • 37. Parameters types ● Named Parameters ● Optional Parameters ● Default Parameters
  • 38. Named Parameters ● eg: Function definition : void enableFlags({bool bold, bool hidden}) {...} Function call: enableFlags(bold: true, hidden: false);
  • 39. Optional Parameters ● Wrapping a set of function parameters in [ ] marks them as optional positional parameters: ● Eg: Function definition : void enableFlags(bool bold, [bool hidden]) {...}
  • 40. Default Parameters ● Your function can use = to define default values for both named and positional parameters. ● The default values must be compile-time constants. ● default value is provided, the default value is null. ● Eg: void enableFlags({bool bold = false, bool hidden = false}) {...}
  • 42. Exception ● Exceptions are errors indicating that something unexpected happened. ● When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally. ● Eg var n=10~/0; Output: Error occured ZeroDivision.
  • 43. The try / on / catch Blocks ● syntax try { // code that might throw an exception } on Exception1 { // code for handling exception } catch Exception2 { // code for handling exception }finally { // code that should always execute; irrespective of the exception }
  • 44. Example try / on / catch ● try { res = 10 ~/ 0; } on IntegerDivisionByZeroException { print('Cannot divide by zero'); } ● try { res = 10 ~/ 0; } catch(e) { print(e); }
  • 46. Throw ● The throw keyword is used to explicitly raise an exception. ● A raised exception should be handled to prevent the program from exiting abruptly. ● The syntax for raising an exception explicitly is − throw new Exception_name();
  • 47. Eg : of Throws main() { try { test_age(-2); } catch(e) { print('Age cannot be negative'); } } void test_age(int age) { if(age<0) { throw new FormatException(); } }
  • 49. OOPs (Object-Oriented Programming System) ● Object means a real-world entity such as a pen, chair, table, computer, watch, etc. ● Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. ● It simplifies software development and maintenance by providing some concepts:- ○ Object ○ Class ○ Inheritance ○ Polymorphism ○ Abstraction ○ Encapsulation
  • 50.
  • 51. Object ● Any entity that has state and behavior is known as an object. For example, a chair, pen, table, keyboard, bike, etc. It can be physical or logical. ● An Object can be defined as an instance of a class. ● An object contains an address and takes up some space in memory. ● Objects can communicate without knowing the details of each other's data or code. ● Example: A dog is an object because it has states like color, name, breed, etc. as well as behaviors like wagging the tail, barking, eating, etc.
  • 52. Class ● Collection of objects is called class. It is a logical entity. ● A class can also be defined as a blueprint from which you can create an individual object. Class doesn't consume any space.
  • 53. Inheritance ● When one object acquires all the properties and behaviors of a parent object, it is known as inheritance. ● It provides code reusability. ● It is used to achieve runtime polymorphism. ● Types of inheritance:- ○ Single Inheritance ○ Multiple Inheritance ○ Hierarchical Inheritance ○ Multilevel Inheritance ○ Hybrid Inheritance (also known as Virtual Inheritance)
  • 54.
  • 55. Polymorphism ● If one task is performed in different ways, it is known as polymorphism. ● For example: to convince the customer differently, to draw something, for example, shape, triangle, rectangle, etc. ● Another example can be to speak something; for example, a cat speaks meow, dog barks woof, etc.
  • 56. Abstraction ● Hiding internal details and showing functionality is known as abstraction. ● For example phone call, we don't know the internal processing.
  • 57. Encapsulation ● Binding (or wrapping) code and data together into a single unit are known as encapsulation. ● For example, a capsule, it is wrapped with different medicines.
  • 59. Declaring a Class in dart ● Use the class keyword to declare a class in Dart. ● A class definition starts with the keyword class followed by the class name; ● The class body enclosed by a pair of curly braces. ● Syntax class class_name { <fields> <getters/setters> <constructors> <functions> }
  • 60. A class definition can include the following − ● Fields − A field is any variable declared in a class. Fields represent data pertaining to objects. ● Setters and Getters − Allows the program to initialize and retrieve the values of the fields of a class. A default getter/ setter is associated with every class. However, the default ones can be overridden by explicitly defining a setter/ getter. ●
  • 61. Thank You.. PPT created by Vishnu Suresh