Dart Tutorial
Welcome to Dart Tutorial by TutorialKart.
In this series of Dart Tutorials, we learn the basic concepts of Dart programming language.
Pre-requisites to learn Dart
There are no specific pre-requisites to learn Dart programming language. Of course having an idea of programming concepts help you learn faster. These Dart Tutorials are designed to address the beginners who have no idea of programming.
If you know any of the programming languages like C#, Java, JavaScript, etc., learning Dart becomes relatively easy.
IDE for Dart Programming
You can use any text editor present in your PC to write Dart code. Or, you can also use Dart Editor.
Dart Editor is very light-weight and productive for developers.
You can also use Eclipse or IntelliJ IDE to develop Dart applications. They have rich Dart editing experience.
Where is Dart used?
Dart is used in:
- Flutter (Mobile Application Development)
Basics
These list of tutorials deal with the the basics like how to install dart on to your PC, write a simple program in Dart and run it, Dart Variables, how to write comments in Dart programs, conditional statement, looping statements, etc.
Get Started
- Install Dart on WindowsDart Tutorial with step by step process to install Dart on Windows.
- Dart Hello World ProgramDart Tutorial with a basic introduction to Dart programming using a Hello World program.
- Dart VariablesDart Tutorial on how to create a variable, assign value to a variable, explicit declaration, reassigning variable with different datatypes, etc.
- Dart CommentsDart Tutorial on how to write single-line comments and block (multi-line) comments.
Built-in Data Types
Conditional Statements
- Dart IfDart Tutorial with syntax of if-statement, and some example to understand the usage of if-statement.
- Dart If-ElseDart Tutorial with syntax of if-else statement, and some examples to throw some light on its usage.
- Dart If-Else-IfDart Tutorial with syntax of if-else-if statement, and some example to understand the usage of if-else-if statement.
Loop Statements
- Dart While LoopDart Tutorial with syntax for while loop statement, and how to use while loop to execute a block of code repeatedly based on a condition.
- Dart Do-While LoopDart Tutorial with syntax and examples for do-while loop statement.
- Dart For LoopDart Tutorial with syntax and examples for For-loop statement.
- Dart BreakDart Tutorial on how to use break statement to break out of a loop.
- Dart ContinueDart Tutorial on how to use continue statement to skip the execution for current iteration of the loop, and continue with the next iterations.
Operators
- Arithmetic Operators
- Logical Operators
- Equality and Relational Operators
Arithmetic Operators
- AdditionDart Tutorial on how to use Addition Operator to add two numbers.
- SubtractionDart Tutorial on how to use Subtraction Operator to subtract a number from another.
- MultiplicationDart Tutorial on how to use Multiplication Operator to find the product of two numbers.
- Unary MinusDart Tutorial on how to use Unary Minus Operator to invert the sign of given number.
- DivisionDart Tutorial on how to use Division Operator to find the quotient of division of given two numbers.
- Division (Integer Quotient)Dart Tutorial on how to use Division Operator to find the quotient (an integer) of integer division.
- Modulo DivisionDart Tutorial on how to use Modulo Operator to find the remainder of integer division of given two numbers.
- IncrementDart Tutorial on how to use Increment Operator to increase the value in a variable by one.
- DecrementDart Tutorial on how to use Decrement Operator to decrease the value in a variable by one.
Logical Operators
- ANDDart Tutorial about logical AND operator, its syntax, truth table, and usage with examples. AND operator is used when we need to check if given two conditions must be met.
- ORDart Tutorial about logical OR operator, its syntax, truth table, and usage with examples. OR operator is used when we need to check if at least one of the two given conditions must be met.
- NOTDart Tutorial about logical NOT operator, its syntax, truth table, and usage with examples.
Exception Handling
- Dart – Try CatchDart Tutorial with syntax and usage examples for try-catch statement. try-catch statement is used for handling exceptions thrown by the code in realtime.
Functions
- Dart – Recursion FunctionDart Tutorial on how to use a recursion function, a function that calls itself in its body.
Input / Output
- Dart – Read integer from consoleDart Tutorial to read an integer from user via standard input.
- Dart – Read string from consoleDart Tutorial to read a string from user via standard input.
- Dart – Print string to consoleDart Tutorial to print given string to standard output.
- Dart – Print Without NewlineDart Tutorial to print given string to standard output, without trailing new line.
String Operations
These Dart Tutorials cover String Operations that are mostly required while working with Strings. It contains operations like adding two strings, splitting a string by a specific delimiter, replacing a substring with another in a string, computing substring of a string given start index and end index, calculating the length of a string, trimming a string with trailing and leading white space characters, etc.
- Dart – Check if String Contains another StringDart Tutorial for String.contains() method, to check if this string contains other given string.
- Dart – Check if String starts with a Specific StringDart Tutorial for String.startsWith() method, to check if this string starts with other given string.
- Dart – Check if String ends with a Specific StringDart Tutorial for String.endsWith() method, to check if this string ends with other given string.
- Dart – Check if String is EmptyDart Tutorial for String.isEmpty property, to check if this string is empty. isEmpty returns a boolean value of true if the string is empty, or false otherwise.
- Dart – Check if two Strings are equalDart Tutorial to check if two given strings are equal using String.compareTo() method, and Equal-to operator.
- Dart – Compare StringsDart Tutorial to compare two strings using String.compareTo() method: if the first string is greater, lesser, or equal to the second string.
- Dart – Concatenate StringsDart Tutorial to concatenate two or more strings using Addition operator.
- Dart – Concatenate a String with itself Multiple TimesDart Tutorial to concatenate a string with itself multiple times, using Multiplication operator.
- Dart – Convert String to UppercaseDart Tutorial for String.toUpperCase() method, to convert given string to upper case.
- Dart – Convert String to LowercaseDart Tutorial for String.toLowerCase() method, to convert given string to lower case.
- Dart – Convert string into list of charactersDart Tutorial to convert given string into a list of characters using String.split() method.
- Dart – Get Index of Substring in a StringDart Tutorial for String.indexOf() method, to get the index of given substring in this string.
- Dart – Get first character in a stringDart Tutorial to get the first character from this string, using string indexing.
- Dart – Get last character in a stringDart Tutorial to get the last character from this string, using string indexing.
- Dart – Get character at specific index in a stringDart Tutorial to get the character at given index from this string, using string indexing.
- Dart – Iterate over Characters of StringDart Tutorial to iterate over the characters of this string using String.runes.forEach().
- Dart – Replace Substring in a StringDart Tutorial for String.replaceAll() method, to replace all the occurrences of the given substring with the replacement string.
- Dart – Split StringDart Tutorial for String.split() method, to split the string with given separator or delimiter.
- Dart – Split string by commaDart Tutorial to split the given string by comma separator.
- Dart – Split string by spaceDart Tutorial to split the given string by space separator.
- Dart – Substring of a given StringDart Tutorial for String.substring() method, to find the substring of the given string identified using start, and end positions.
- Dart – String LengthDart Tutorial for String.length property, to find the number of characters in the string.
- Dart – Trim StringDart Tutorial for String.trim() method, to trim the whitespaces around the string.
Dart Collections
List, Set, Map and Queue are the collection classes implemented in Dart. In the following Dart Tutorials, we walk you through these Collection classes and different properties and operations that could be performed on them.
In Dart, List is a collection of elements that can belong to different types. Also, elements in list are indexed. We can perform different operations of List with the help of built-in properties and methods of List class or primitive conditional and Looping statements.
Lists
Following series of tutorials deal with the different List Operations that are most useful while developing Dart applications.
- Dart Lists
- Dart – List Length
- Dart – Check if List is Empty
- Dart – Check if two Lists are Equal
- Dart – Iterate over List
- Dart – Add Element to List
- Dart – Check if List contains specific Element
- Dart – Check if any of the Element from List satisfies given Test
- Dart – Check if all Elements from List satisfy given Test
- Dart – Get Element from List at Specific Index
- Dart – Join Lists
- Dart – List forEach()
- Dart – Reverse a List
- Dart – Remove all Elements of a List
- Dart – Shuffle List
- Dart – Convert List to Set
Sets
Dart Set is a collection of unique elements that can belong to different types.
Following series of Dart Tutorials go through most useful operations on Dart Sets.
- Dart – Sets
- Dart – Set Length
- Dart – Check if Set is Empty
- Dart – Add Element to Set
- Dart – Check if Set contains given Element
- Dart – Filter Elements of a Set
- Dart – Remove given Element from Set
- Dart – Remove Elements from Set based on a Condition
- Dart – Union of Sets
- Dart – Intersection of Sets
- Dart – Iterate over elements of Set using For-in
- Dart – Iterate over elements of Set using forEach()
- Dart – Reduce Elements of Set to a Value
Maps
Dart Map is a collection of key:value pairs.
- Maps
- Map Length
- Check if Map is Empty
- Add Entries to Map
- Check if Map contains Key
- Check if Map contains Value
- Remove Entry from Map
- Iterate over Entries of Map
Runes
Symbols
Object Oriented Concepts
- Dart – Class
- Dart – Inheritance
- Dart – Method Overriding
- Dart – Enum
- Dart Tutorial – Interface
Object Class related Tutorials
Date and Time
Dart Others
- Dart Tutorial – Dart Date Time
- Dart Tutorial – Dart Duration
Dart Programs
- Dart Program – Sum of two numbers
- Dart Program – Square root of a number
- Dart Program – Average of two numbers
- Dart Program – Sum of first N natural numbers
- Dart Program – Sum of squares of first N natural numbers
- Dart Program – Check if N is prime number
- Dart Program – Print prime numbers between two given numbers
- Dart Program – Factorial of a number
- Dart Program – Find factors of a number
- Dart Program – Product of digits in a given number
- Dart Program – Sum of digits in a given number
Conclusion
In these series of Dart Tutorials, we introduced different concepts to get you started with Application Development using Dart programming.