Dart Programming Articles

Page 3 of 3

Ternary Operator in Dart Programming

Mukul Latiyan
Mukul Latiyan
Updated on 11-Mar-2026 9K+ Views

The ternary operator is a shorthand version of an if-else condition. There are two types of ternary operator syntax in Dart, one with a null safety check and the other is the same old one we encounter normally.Syntax 1condition ? expressionOne : expressionTwo;The above syntax implies that if a certain condition evaluates to true then we evaluate the expressionOne first and then the expressionTwo.ExampleLet's explore a Dart example where we make use of the above syntax of the ternary operator.Consider the example shown below −void main(){    var ans = 10;    ans == 10 ? print("Answer is 10") : ...

Read More

This keyword in Dart Programming

Mukul Latiyan
Mukul Latiyan
Updated on 11-Mar-2026 906 Views

This keyword in dart is used to remove the ambiguity that can be caused if the class attributes and the parameters have the same name. This keyword basically represents an implicit object pointing to the current class object.We usually prefix the class attribute with this keyword whenever we want to remove the ambiguity between the class attributes and the parameters.ExampleLet's take two examples of the case where the name of the class attribute and the parameters are the same.Consider the example shown below −void main() {    Employee emp = new Employee('001');    emp.empCode = '111'; } class Employee ...

Read More

Difference Between Golang and Dart

Sabid Ansari
Sabid Ansari
Updated on 12-Apr-2023 2K+ Views

Golang and Dart are two popular programming languages used in developing web, mobile, and desktop applications. Golang is a compiled programming language that was developed by Google in 2007. On the other hand, Dart is a relatively new programming language developed by Google in 2011. Both languages have their unique features and advantages, but also their differences. In this article, we will compare Golang and Dart in terms of performance, syntax, community, and use cases. Difference Between Golang and Dart Performance Comparison One of the major factors in choosing a programming language is performance. Both Golang and Dart are known ...

Read More

Null Aware Operators in Dart Programming

Mukul Latiyan
Mukul Latiyan
Updated on 24-May-2021 725 Views

Dart has different null aware operators that we can use to make sure that we are not accessing the null values and to deal with them in a subtle way.Mainly, these are −?? operator??= operator? operatorWe will go through each of them in the following article.?? operatorThe ?? operator returns the first expression if and only if it is not null.ExampleConsider the example shown below −void main() {    var age;    age = age ?? 23;    print(age);    var name = "mukul";    name = name ?? "suruchi";    print(name); }In the above example, we declared two ...

Read More

Immutability in Dart Programming

Mukul Latiyan
Mukul Latiyan
Updated on 21-May-2021 793 Views

Immutability is the ability to remain constant. Whenever we talk about immutability we mention the immutable nature.In object oriented and functional programming, we make use of the immutable nature of objects a lot. Being immutable means that the state of the object cannot be modified after its creation.It is a very important topic these days when we talk about front-end development, as there are several occasions and scenarios where we want to maintain the state and the way to do that is to make use of immutability.In Dart, there are different ways with which we can achieve immutability and sometimes ...

Read More

Future class in Dart Programming

Mukul Latiyan
Mukul Latiyan
Updated on 21-May-2021 548 Views

There are different classes and keywords in Dart which we can use when we want to run Asynchronous code. The future class allows us to run asynchronous code and we can also avoid the callback hell with the help of it. A future mainly represents the result of an asynchronous operation.In Dart, there are many standards library calls that return a future, some of them are −http.getSharedPreference.getInstance()A future in Dart can have two states, these are −Completed - When the operation of the future finishes and the future complete with a value or with an error.Uncompleted - When a function is called, and it ...

Read More
Showing 21–26 of 26 articles
« Prev 1 2 3 Next »
Advertisements