Library Categories
Dart’s core libraries can be grouped into several categories:Essential Libraries
dart:core - Automatically imported into every Dart program. Provides built-in types, collections, and other fundamental functionality. dart:async - Support for asynchronous programming with classes such as Future and Stream.Platform-Specific Libraries
dart:io - File, socket, HTTP, and other I/O support for non-web applications (servers, CLI apps, Flutter). dart:html - HTML elements and other resources for web-based applications.Specialized Libraries
dart:ffi - Foreign Function Interface for interoperability with the C programming language. dart:isolate - Concurrent programming using isolates: independent workers similar to threads.Platform Availability
Not all libraries are available on all platforms:
- dart:io, dart:ffi, and dart:isolate are only available on Dart Native (VM, AOT, and Flutter)
- dart:html is only available on web platforms
- dart:core and dart:async are available on all platforms
Import Syntax
Most core libraries need to be explicitly imported, except fordart:core which is automatically imported:
Common Use Cases
Asynchronous Operations
Use
dart:async for Futures, Streams, and async/await patternsFile I/O
Use
dart:io for reading/writing files and directoriesNative Interop
Use
dart:ffi for calling C libraries and native codeParallel Execution
Use
dart:isolate for CPU-intensive tasks in separate isolatesNext Steps
Explore each library in detail:- dart:core - Built-in types and collections
- dart:async - Asynchronous programming
- dart:collection - Collections and data structures
- dart:convert - Encoders and decoders (JSON, UTF-8, Base64)
- dart:io - I/O for non-web apps
- dart:ffi - C interoperability
- dart:html - Web programming
- dart:isolate - Concurrent programming
- dart:js_interop - JavaScript interoperability
- dart:math - Mathematical functions and constants