-
-
Notifications
You must be signed in to change notification settings - Fork 0
Introduction
Multithreading and worker pools in Dart. Offload CPU-bound and long running tasks and give your mobile and Web apps some air! |
Dart is a programming language developed by Google, designed for building high-performance, cross-platform applications. Applications built with Dart can run in various environments, including Web browsers, mobile devices, desktops, and servers.
When running a Dart application, especially in asynchronous scenarios, an event loop plays a crucial role in managing and coordinating the execution of tasks within the program. The event loop is a fundamental concept in event-driven programming, allowing an application to handle multiple concurrent tasks without blocking or waiting for each task to complete before moving on to the next one. Instead, the event loop continuously monitors and dispatches events and tasks, ensuring efficient and non-blocking execution. In the context of Dart, the event loop is provided by the underlying Dart runtime which is responsible for executing Dart code. Typically, when a Dart program is started, the Dart runtime executes the program's entry point (the |
Dart also implements the concept of isolates: execution units that have their own private memory space. On native platforms, isolates are implemented in Dart's Isolate class; on Web platforms, isolates map to Web Workers. While Isolates and Web Workers are conceptually the same, they are not interchangeable at code level and require specific attention.
This dichotomy makes it hard to write code that will run happily on both native and Web platforms.
Squadron is here to bridge that gap.