Local Storage

Dart’s support for client-side storage is still somewhat unsettled, but as you saw in Chapter 11, Project: Varying Behavior, it is far enough along that we can already perform localStorage. Although it is synchronous and can be slow, localStorage is the most widely supported client-side storage solution—and the only one currently supported by Dart.

Because it’s synchronous (that is, its operations block other activity in client-side applications), it is not well suited for large stores of data. Still, it’s quite handy for smaller datasets and prototyping. There is a benefit to its synchronous nature: far less ceremony is involved in using it.

The API for working with localStorage is similar to the traditional JavaScript API—although ...

Get Dart 1 for Everyone now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.