Full Transcript

Session 1 Introduction to Dart © Aptech Limited Introduction to Dart Programming/ Session 1 / 1 of 15 Session Overview Define Dart and explain the history of Dart Describe the features of Dart...

Session 1 Introduction to Dart © Aptech Limited Introduction to Dart Programming/ Session 1 / 1 of 15 Session Overview Define Dart and explain the history of Dart Describe the features of Dart List the advantages of Dart Explain the installation of Dart Software Development Kit in Android Studio Identify the basic syntax in Dart Explain identifiers in Dart List the basic keywords in Dart Elaborate the process of creating a simple Dart application and executing it © Aptech Limited Introduction to Dart Programming/ Session 1 / 2 of 15 What is Dart? [1-2] Dart is an open-source programming language developed by Google. Dart SDK has the Dart Virtual Machine compiler and a utility called dart2js. Dart is an object-oriented programming language. Thus, it has support for classes, polymorphism, interfaces, and abstraction. Dart follows a C-style syntax. It is a multi-purpose language. © Aptech Limited Introduction to Dart Programming/ Session 1 / 3 of 15 What is Dart? [2-2] Dart is also a cross-platform or platform-independent programming language. This means that it can be run on several operating systems such as Windows, Linux, and MacOS. Following are different types of applications that can be developed using Dart: Web Mobile Desktop Server © Aptech Limited Introduction to Dart Programming/ Session 1 / 4 of 15 History of Dart Started by Lars First edition Evolution of The Success Bak Release Dart Compilers The Dart project The first edition of dartc was the initial dart2js was a success and was started by a Dart was released compiler. Later, it still continues to be used Danish programmer in July 2014, was Frog and finally in Dart for applications who was popular followed by the it was dart2js. with optimal for his work on second edition in performance that can be virtual machines. the next six built for multiple months. platforms. © Aptech Limited Introduction to Dart Programming/ Session 1 / 5 of 15 Features of Dart Open Source Extensive Libraries Platform Independent Browser Support Object Oriented Concurrency Type Safe Community Easy to Learn Flexible Compilation © Aptech Limited Introduction to Dart Programming/ Session 1 / 6 of 15 Usage and Benefits of Dart Universal code that works for several platforms such as Android, iOS, and Web browsers and does not require any change. Detecting errors statically and code optimization. Provides null safety, which results in lesser instances of app crash. Dart is backed by Google. © Aptech Limited Introduction to Dart Programming/ Session 1 / 7 of 15 Steps to Install Dart SDK in Android Studio © Aptech Limited Introduction to Dart Programming/ Session 1 / 8 of 15 Understanding Basic Dart Syntax The basic syntax in a Dart program comprises several elements such as keywords, data types, variables, constants, string literals, and symbols. The main() method acts as an entry point to a Dart application. A variable x is declared and assigned the data type int. Another variable y is also declared and assigned as string. void main(){ int x = 5; string y = “Daniel”; } © Aptech Limited Introduction to Dart Programming/ Session 1 / 9 of 15 Identifiers in Dart Rules for naming an identifier are as follows: Can have $ and Can have a set of Can start with Can start with _ as special characters an alphabet an underscore characters Cannot Cannot start with Cannot have Cannot be contain any a number keywords duplicated spaces © Aptech Limited Introduction to Dart Programming/ Session 1 / 10 of 15 Example of Identifiers in Dart Invalid Valid Identifiers Explanation Explanation Identifiers firstName Begins with lowercase first Name Space not allowed first_name Has underscore first-name Hyphen not allowed sum1 Begins with lowercase Var Begins with uppercase _name Begins with underscore 1name Begins with a number (private variable) © Aptech Limited Introduction to Dart Programming/ Session 1 / 11 of 15 Keywords in Dart Keywords in Dart are reserved words that the compiler interprets in a special manner. Each keyword has a unique connotation and purpose in the Dart programming language. Keywords are case-sensitive and cannot be used for naming variables, functions, and classes. abstract import else super in as enum switch assert export interface sync async extends await this throw library break continue try catch final class © Aptech Limited Introduction to Dart Programming/ Session 1 / 12 of 15 Steps to Create a Simple Hello World Dart application © Aptech Limited Introduction to Dart Programming/ Session 1 / 13 of 15 Output of the Hello World Dart Application © Aptech Limited Introduction to Dart Programming/ Session 1 / 14 of 15 Summary Dart is a client-centric open source language for developing applications at a faster pace across several platforms. The goal of Dart is to be the most fruitful programming language for development across multiple platforms. Dart is designed to cater to client development while prioritizing sub-second stateful hot reloads as well as high-quality production across a wide variety of compilation targets (Web, mobile, and desktop). Dart provides the language and runtimes that fuel Flutter applications. Dart supports all modern browsers such as Chrome, Mozilla Firefox, and Internet Explorer for Web applications. Dart program supports and backs multithreading by making use of isolates. © Aptech Limited Introduction to Dart Programming/ Session 1 / 15 of 15

Use Quizgecko on...
Browser
Browser