ChromeTopSites class
class ChromeTopSites extends ChromeApi { static final JsObject _topSites = chrome['topSites']; ChromeTopSites._(); bool get available => _topSites != null; /** * Gets a list of top sites. */ Future<List<MostVisitedURL>> get() { if (_topSites == null) _throwNotAvailable(); var completer = new ChromeCompleter<List<MostVisitedURL>>.oneArg((e) => listify(e, _createMostVisitedURL)); _topSites.callMethod('get', [completer.callback]); return completer.future; } void _throwNotAvailable() { throw new UnsupportedError("'chrome.topSites' is not available"); } }
Extends
ChromeApi > ChromeTopSites
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 => _topSites != null;
Methods
Future<List<MostVisitedURL>> get() #
Gets a list of top sites.
Future<List<MostVisitedURL>> get() { if (_topSites == null) _throwNotAvailable(); var completer = new ChromeCompleter<List<MostVisitedURL>>.oneArg((e) => listify(e, _createMostVisitedURL)); _topSites.callMethod('get', [completer.callback]); return completer.future; }