Dart has the following libraries, which are included in all Dart platforms:
This library is automatically imported into every Dart program. The dart:core library provides a small but critical set of built-in functionality.
Asynchronous programming often uses callback functions, but Dart provides alternatives: Future and Stream objects. A Future is like a promise for a result to be provided sometime in the future. A Stream is a way to get a sequence of values, such as events. Future, Stream, and more are in the dart:async library
The dart:async library works in both web apps and command-line apps. To use it, import dart:async:
The dart:math library provides common functionality such as sine and cosine, maximum and minimum, and constants such as pi and e. Most of the functionality in the Math library is implemented as top-level functions.
To use this library in your app, import dart:math.
The dart:convert library has converters for JSON and UTF-8, as well as support for creating additional converters. JSON is a simple text format for representing structured objects and collections. UTF-8 is a common variable-width encoding that can represent every character in the Unicode character set.
The dart:convert library works in both web apps and command-line apps. To use it, import dart:convert.
dart:html library used to program the browser, manipulate objects and elements in the DOM, and access HTML5 APIs. DOM stands for Document Object Model, which describes the hierarchy of an HTML page.
Other common uses of dart:html are manipulating styles (CSS), getting data using HTTP requests, and exchanging data using WebSockets. HTML5 (and dart:html) has many additional APIs that this section doesn’t cover. Only web apps can use dart:html, not command-line apps.
To use the HTML library in your web app, import dart:html:
The dart:io library provides APIs to deal with files, directories, processes, sockets, WebSockets, and HTTP clients and servers.
In general, the dart:io library implements and promotes an asynchronous API. Synchronous methods can easily block an application, making it difficult to scale. Therefore, most operations return results via Future or Stream objects, a pattern common with modern server platforms such as Node.js.
The few synchronous methods in the dart:io library are clearly marked with a Sync suffix on the method name. Synchronous methods aren’t covered here.
To use the dart:io library you must import it: