Using a browser's local storage
Local storage (also called the Web Storage API) is widely supported in modern browsers. It enables the application's data to be persisted locally (on the client side) as a map-like structure: a dictionary of key-value string pairs, in fact using JSON strings to store and retrieve data. It provides our application with an offline mode of functioning when the server is not available to store the data in a database. Local storage does not expire, but every application can only access its own data up to a certain limit depending on the browser. In addition, of course, different browsers can't access each other's stores.
How to do it...
Look at the following example, the local_storage.dart
file:
import 'dart:html'; Storage local = window.localStorage; void main() { var job1 = new Job(1, "Web Developer", 6500, "Dart Unlimited") ;
Perform the following steps to use the browser's local storage:
Write to a local storage with the key
Job:1
using the following code:...