Dart Documentationchrome.storageChromeStorage

ChromeStorage class

class ChromeStorage extends ChromeApi {
 static final JsObject _storage = chrome['storage'];

 ChromeStorage._();

 bool get available => _storage != null;

 /**
  * Items in the `sync` storage area are synced using Chrome Sync.
  */
 SyncStorageArea get sync => _createSyncStorageArea(_storage['sync']);

 /**
  * Items in the `local` storage area are local to each machine.
  */
 LocalStorageArea get local => _createLocalStorageArea(_storage['local']);

 /**
  * Fired when one or more items change.
  */
 Stream<StorageOnChangedEvent> get onChanged => _onChanged.stream;

 final ChromeStreamController<StorageOnChangedEvent> _onChanged =
     new ChromeStreamController<StorageOnChangedEvent>.twoArgs(_storage, 'onChanged', _createOnChangedEvent);

 void _throwNotAvailable() {
   throw new UnsupportedError("'chrome.storage' is not available");
 }
}

Extends

ChromeApi > ChromeStorage

Properties

final bool available #

Returns true if the API is available. The common causes of an API not being avilable are:

  • a permission is missing in the application's manifest.json file
  • the API is defined on a newer version of Chrome then the current runtime
docs inherited from ChromeApi
bool get available => _storage != null;

final LocalStorageArea local #

Items in the local storage area are local to each machine.

LocalStorageArea get local => _createLocalStorageArea(_storage['local']);

final Stream<StorageOnChangedEvent> onChanged #

Fired when one or more items change.

Stream<StorageOnChangedEvent> get onChanged => _onChanged.stream;

final SyncStorageArea sync #

Items in the sync storage area are synced using Chrome Sync.

SyncStorageArea get sync => _createSyncStorageArea(_storage['sync']);