Dart Documentationchrome.storageLocalStorageArea

LocalStorageArea class

class LocalStorageArea extends StorageArea {
 LocalStorageArea();
 LocalStorageArea.fromProxy(JsObject jsProxy): super.fromProxy(jsProxy);

 /**
  * The maximum amount (in bytes) of data that can be stored in local storage,
  * as measured by the JSON stringification of every value plus every key's
  * length. This value will be ignored if the extension has the
  * `unlimitedStorage` permission. Updates that would cause this limit to be
  * exceeded fail immediately and set [runtime.lastError.]
  */
 int get QUOTA_BYTES => jsProxy['QUOTA_BYTES'];
}

Extends

ChromeObject > StorageArea > LocalStorageArea

Constructors

new LocalStorageArea() #

Create a new instance of a ChromeObject, which creates and delegates to a JsObject proxy.

docs inherited from ChromeObject
LocalStorageArea();

new LocalStorageArea.fromProxy(JsObject jsProxy) #

Create a new instance of a ChromeObject, which delegates to the given JsObject proxy.

docs inherited from ChromeObject
LocalStorageArea.fromProxy(JsObject jsProxy): super.fromProxy(jsProxy);

Properties

final jsProxy #

inherited from ChromeObject
final dynamic jsProxy

final int QUOTA_BYTES #

The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError.

int get QUOTA_BYTES => jsProxy['QUOTA_BYTES'];

Methods

Future clear() #

inherited from StorageArea

Removes all items from storage.

Future clear() {
 var completer = new ChromeCompleter.noArgs();
 jsProxy.callMethod('clear', [completer.callback]);
 return completer.future;
}

Future<Map<String, dynamic>> get([keys]) #

inherited from StorageArea

Gets one or more items from storage.

keys A single key to get, list of keys to get, or a dictionary specifying default values (see description of the object). An empty list or object will return an empty result object. Pass in null to get the entire contents of storage.

Returns: Object with items in their key-value mappings.

Future<Map<String, dynamic>> get([dynamic keys]) {
 var completer = new ChromeCompleter<Map<String, dynamic>>.oneArg(mapify);
 jsProxy.callMethod('get', [jsify(keys), completer.callback]);
 return completer.future;
}

Future<int> getBytesInUse([keys]) #

inherited from StorageArea

Gets the amount of space (in bytes) being used by one or more items.

keys A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage.

Returns: Amount of space being used in storage, in bytes.

Future<int> getBytesInUse([dynamic keys]) {
 var completer = new ChromeCompleter<int>.oneArg();
 jsProxy.callMethod('getBytesInUse', [jsify(keys), completer.callback]);
 return completer.future;
}

Future remove(keys) #

inherited from StorageArea

Removes one or more items from storage.

keys A single key or a list of keys for items to remove.

Future remove(dynamic keys) {
 var completer = new ChromeCompleter.noArgs();
 jsProxy.callMethod('remove', [jsify(keys), completer.callback]);
 return completer.future;
}

Future set(Map<String, dynamic> items) #

inherited from StorageArea

Sets multiple items.

items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.

Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation).

Future set(Map<String, dynamic> items) {
 var completer = new ChromeCompleter.noArgs();
 jsProxy.callMethod('set', [jsify(items), completer.callback]);
 return completer.future;
}

JsObject toJs() #

inherited from ChromeObject
JsObject toJs() => jsProxy;

String toString() #

inherited from ChromeObject

Returns a string representation of this object.

docs inherited from Object
String toString() => jsProxy.toString();