Concurrency

Concurrency is the execution of several instruction sequences at the same time. It involves performing more than one task simultaneously. Dart uses Isolates as a tool for doing works in parallel. The dart:isolate package is Dart’s solution to taking single-threaded Dart code and allowing the application to make greater use of the hard-ware available. Isolates,… Continue reading Concurrency

Published
Categorized as Dart Tagged

Async

An asynchronous operation executes in a thread, separate from the main application thread. When an application calls a method to perform an operation asynchronously, the application can continue executing while the asynchronous method performs its task. import ‘dart:io’;  void main() {    print(“Enter your name :”);             // prompt for user input    String name = stdin.readLineSync();  … Continue reading Async

Published
Categorized as Dart Tagged

Importing and using a Library

The following example imports the built-in library dart: math. The snippet calls the sqrt() function from the math library. This function returns the square root of a number passed to it. import ‘dart:math’;  void main() {    print(“Square root of 36 is: ${sqrt(36)}”);  } Output Square root of 36 is: 6.0

Published
Categorized as Dart Tagged

Dart library

1)dart:io File, socket, HTTP, and other I/O support for server applications. This library does not work in browser-based applications. This library is imported by default. 2)dart:core Built-in types, collections, and other core functionality for every Dart program. This library is automatically imported. 3)dart: math Mathematical constants and functions, plus a random number generator. 4)dart: convert… Continue reading Dart library

Dart – Static Keyword

The static keyword is used for memory management of global data members. The static keyword can be applied to the fields and methods of a class. The static variables and methods are part of the class instead of a specific instance. The static keyword is used for a class-level variable and method that is the… Continue reading Dart – Static Keyword

How to Exit a Dart Application Unconditionally?

The exit() method exits the current program by terminating running Dart VM. This method takes a status code. A non-zero value of status code is generally used to indicate abnormal termination. This is a similar exit in C/C++, Java. This method doesn’t wait for any asynchronous operations to terminate. Syntax: exit(exit_code); To use this method, we have… Continue reading How to Exit a Dart Application Unconditionally?

Published
Categorized as Dart Tagged ,

Splitting of String

In Dart splitting of a string can be done with the help split string function in the dart. It is a built-in function use to split the string into substring across a common character. Syntax: string_name.split(pattern) This function splits the string into substring across the given pattern and then store them to a list. Example1: Splitting… Continue reading Splitting of String

Dart Classes and Object

Dart classes are the blueprint of the object, or it can be called object constructors. A class can contain fields, functions, constructors, etc. It is a wrapper that binds/encapsulates the data and functions together; that can be accessed by creating an object. A class can refer to as user-define data type which defines characteristics by… Continue reading Dart Classes and Object

How to Combine Lists in Dart?

In Dart programming, the List data type is similar to arrays in other programming languages. A list is used to represent a collection of objects. It is an ordered group of objects. The core libraries in Dart are responsible for the existence of List class, its creation, and manipulation. These are some ways to combine… Continue reading How to Combine Lists in Dart?

Published
Categorized as Dart Tagged

Dart Function

Dart function is a set of codes that together perform a specific task. It is used to break the large code into smaller modules and reuse it when needed. Functions make the program more readable and easy to debug. It improves the modular approach and enhances the code reusability. Suppose, we write a simple calculator… Continue reading Dart Function