The goal of this book is not to go through all the APIs that come with HTML5, but there are some that are worth taking a look at, including some interesting Dart libraries. You probably won't use them on a daily basis, but it's good to know that there's such things available to you.
Even though everything in Dart is an object and the VM is very well optimized, there's a built-in dart:typed_data
library, which we already mentioned in the audio visualizer app. This library contains data structures (mostly lists) with fixed size n-bit signed / unsigned integers / floats. In other words, lists that can contain only n-bit numbers and no objects.
In practice, if we knew we wanted to store only 8-bit values (that's 0-255) in an array, we could use the Uint8List
class instead of List<int>
. This could represent, for example, image colors:
import 'dart:io'; import 'dart:typed_data'; main() { const max = 10 * 1000 * 1000...