Author: admin
-
Comprehensions
List comprehensions are syntactic sugar for looping through enumerables in Elixir. In this chapter we will use comprehensions for iteration and generation. Basics When we looked at the Enum module in the enumerables chapter, we came across the map function. In this example, we will pass a function as the second argument. Each item in…
-
Typedef
A typedef, or a function-type alias, helps to define pointers to executable code within memory. Simply put, a typedef can be used as a pointer that references a function. Given below are the steps to implement typedefs in a Dart program. Step 1: Defining a typedef A typedef can be used to specify a function signature that we want specific functions to…
-
Sigils
In this chapter, we are going to explore sigils, the mechanisms provided by the language for working with textual representations. Sigils start with the tilde (~) character which is followed by a letter (which identifies the sigil) and then a delimiter; optionally, modifiers can be added after the final delimiter. Regex Regexes in Elixir are…
-
Debugging
Every now and then, developers commit mistakes while coding. A mistake in a program is referred to as a bug. The process of finding and fixing bugs is called debugging and is a normal part of the development process. This section covers tools and techniques that can help you with debugging tasks. The WebStorm editor…
-
Exceptions
An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally. Built-in Dart exceptions include − Sr.No Exceptions & Description 1 DeferredLoadExceptionThrown when a deferred library fails to load. 2 FormatExceptionException thrown when…
-
Packages
A package is a mechanism to encapsulate a group of programming units. Applications might at times need integration of some third-party libraries or plugins. Every language has a mechanism for managing external packages like Maven or Gradle for Java, Nuget for .NET, npm for Node.js, etc. The package manager for Dart is pub. Pub helps to…
-
Generics
Dart is an optionally typed language. Collections in Dart are heterogeneous by default. In other words, a single Dart collection can host values of various types. However, a Dart collection can be made to hold homogenous values. The concept of Generics can be used to achieve the same. The use of Generics enforces a restriction on…
-
Collection
Dart, unlike other programming languages, doesn’t support arrays. Dart collections can be used to replicate data structures like an array. The dart:core library and other classes enable Collection support in Dart scripts. Dart collections can be basically classified as − Sr.No Dart collection & Description 1 ListA List is simply an ordered group of objects.…
-
Object
Object-Oriented Programming defines an object as “any entity that has a defined boundary.” An object has the following − The period operator (.) is used in conjunction with the object to access a class’ data members. Example Dart represents data in the form of objects. Every class in Dart extends the Object class. Given below is a…
-
Classes
Dart is an object-oriented language. It supports object-oriented programming features like classes, interfaces, etc. A class in terms of OOP is a blueprint for creating objects. A class encapsulates data for the object. Dart gives built-in support for this concept called class. Declaring a Class Use the class keyword to declare a class in Dart. A class definition starts with the keyword class followed…