Dart Documentationchrome.storageSyncStorageArea

SyncStorageArea class

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

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

 /**
  * The maximum size (in bytes) of each individual item in sync storage, as
  * measured by the JSON stringification of its value plus its key length.
  * Updates containing items larger than this limit will fail immediately and
  * set [runtime.lastError.]
  */
 int get QUOTA_BYTES_PER_ITEM => jsProxy['QUOTA_BYTES_PER_ITEM'];

 /**
  * The maximum number of items that can be stored in sync storage. Updates
  * that would cause this limit to be exceeded will fail immediately and set
  * [runtime.lastError.]
  */
 int get MAX_ITEMS => jsProxy['MAX_ITEMS'];

 /**
  * The maximum number of `set`, `remove`, or `clear` operations that can be
  * performed each hour. Updates that would cause this limit to be exceeded
  * fail immediately and set [runtime.lastError.]
  */
 int get MAX_WRITE_OPERATIONS_PER_HOUR => jsProxy['MAX_WRITE_OPERATIONS_PER_HOUR'];

 /**
  * The maximum number of `set`, `remove`, or `clear` operations that can be
  * performed each minute, sustained over 10 minutes. Updates that would cause
  * this limit to be exceeded fail immediately and set [runtime.lastError.]
  */
 int get MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE => jsProxy['MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE'];
}

Extends

ChromeObject > StorageArea > SyncStorageArea

Constructors

new SyncStorageArea() #

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

docs inherited from ChromeObject
SyncStorageArea();

new SyncStorageArea.fromProxy(JsObject jsProxy) #

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

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

Properties

final jsProxy #

inherited from ChromeObject
final dynamic jsProxy

final int MAX_ITEMS #

The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError.

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

final int MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE #

The maximum number of set, remove, or clear operations that can be performed each minute, sustained over 10 minutes. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError.

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

final int MAX_WRITE_OPERATIONS_PER_HOUR #

The maximum number of set, remove, or clear operations that can be performed each hour. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError.

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

final int QUOTA_BYTES #

The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError.

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

final int QUOTA_BYTES_PER_ITEM #

The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError.

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

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();