The string property codeunits in Dart programming language returned the list of UTF-16 code of the characters of a string. It is very useful string properties to directly find UTF-16 code units. Syntax: String.codeUnits Returns: a list of UTF-16 code units // main function start void main() { // initialize string st String st… Continue reading Dart – String codeUnits Property
Category: Dart
HTML Document Object Model
We all know that dart is a type of javascript. So we can manipulate data inside HTML pages with the help of dart in a similar fashion as we can do with javascript. In HTML DOM (Document Object Model) every webpage is on a window, so it is considered as an object. The hierarchical model… Continue reading HTML Document Object Model
Dart – Unit Testing
Unit Testing is a process of testing individual components of a software/application separately, to ensure that each component is functioning as intended. It provides multiple advantages such as – Ability to test out individual components without running the whole software/application. Pinpoint errors easily inside a specific component. Dart provides a package called test which lets… Continue reading Dart – Unit Testing
Dart – Symbols
In Dart, Symbols are basically an object representation of either an identifier or operator. The symbols in dart are opaque and dynamic string names that cannot be changed and remains constant throughout the compile time. It can be used for reflecting the metadata on a type, such as a library or class. They are generally used… Continue reading Dart – Symbols
What is a future?
A future (lower case “f”) is an instance of the Future (capitalized “F”) class. A future represents the result of an asynchronous operation, and can have two states: uncompleted or completed. Uncompleted When you call an asynchronous function, it returns an uncompleted future. That future is waiting for the function’s asynchronous operation to finish or… Continue reading What is a future?
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
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
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
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