dart

dart

Dart string splitMapJoin examples

splitMapJoin is an utility method of dart string. It is used to split a string, convert its part and join the parts back to a new string.

Read
dart

Dart program to capitalize the first character of a string

Dart doesn't provide any inbuilt method to capitalize the first string character. We can either write our own utility function or we can use the intl package. In this blog post, I will show you two different ways to capitalize the first letter of a dart string.

Read
dart

How to do run-time type checking in Dart

If we are not declaring the type of a variable, we can assign any type to it. The compiler will not throw any error. Only in run-time, we will get type-mismatched.

Read
dart

What are mixins in Dart

Dart 2.1 introduced one new concept called mixins. In simple words, this is a class that contains methods that can be used by other classes. So, don't we have already inheritance ? We can extend one class, right ? We can have one abstract class and extend it. So, why mixins ?

Read
dart

Generics in Dart explanation with example

Generic is a concept to use different types of values with a single type of definition. For example, we can create different types of lists in dart like List is for a string list, List is for an integer list etc. Here, List is a generic type. If you check its definition, you will see that it is defined as List. Here, E letter stands for element. By convention letter E, T, S, K and V are used for generic. For example, map class is defined as Map<K, V>.Map, Set, List and Queue are examples of generic implementation.

Read
dart

Enumeration in Dart explanation with example

Enumeration is an user defined list of constants values. This is a class and also known as enums or enumerated types. Enums are normally used in switch-case blocks. If you are familiar with enums in any other programming languages like Java, enums in Dart is similar to that.

Read
dart

Implicit interface in Dart with examples

Dart doesn't have any interface keyword to define an interface. In Dart, each class implicitly defines an interface. This interface holds all the instance members of the class and of any other classes it implements.

Read
dart

Dart class inheritance : extends and override

Class inheritance allows one class to inherit properties of a different class. Dart supports single inheritance i.e. one class can inherit from only one class. extends keyword is used for inheritance. The syntax of extends is :.

Read
dart

Abstract method and abstract class in Dart

A class can be abstract or a method can be abstract in Dart. 'abstract' keyword is used to declare an Abstract class. An abstract can't be instantiated or we can't create any objects of abstract class. So, what is its use case ? You can only extend an abstract class.

Read
dart

Instance method in Dart with examples

In simple words, instance methods are methods defined in a class those are available with class objects. Instance methods can access to instance variables and this. For example, let's consider the below program :.

Read