Dart Documentationchrome.devtoolsChromeDevtoolsNetwork

ChromeDevtoolsNetwork class

Use the chrome.devtools.network API to retrieve the information about network requests displayed by the Developer Tools in the Network panel.

class ChromeDevtoolsNetwork extends ChromeApi {
 static final JsObject _devtools_network = chrome['devtools']['network'];

 ChromeDevtoolsNetwork._();

 bool get available => _devtools_network != null;

 /**
  * Returns HAR log that contains all known network requests.
  * 
  * Returns:
  * A HAR log. See HAR specification for details.
  */
 Future<Map<String, dynamic>> getHAR() {
   if (_devtools_network == null) _throwNotAvailable();

   var completer = new ChromeCompleter<Map<String, dynamic>>.oneArg(mapify);
   _devtools_network.callMethod('getHAR', [completer.callback]);
   return completer.future;
 }

 /**
  * Fired when a network request is finished and all request data are
  * available.
  */
 Stream<Request> get onRequestFinished => _onRequestFinished.stream;

 final ChromeStreamController<Request> _onRequestFinished =
     new ChromeStreamController<Request>.oneArg(_devtools_network, 'onRequestFinished', _createRequest);

 /**
  * Fired when the inspected window navigates to a new page.
  */
 Stream<String> get onNavigated => _onNavigated.stream;

 final ChromeStreamController<String> _onNavigated =
     new ChromeStreamController<String>.oneArg(_devtools_network, 'onNavigated', selfConverter);

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

Extends

ChromeApi > ChromeDevtoolsNetwork

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 => _devtools_network != null;

final Stream<String> onNavigated #

Fired when the inspected window navigates to a new page.

Stream<String> get onNavigated => _onNavigated.stream;

final Stream<Request> onRequestFinished #

Fired when a network request is finished and all request data are available.

Stream<Request> get onRequestFinished => _onRequestFinished.stream;

Methods

Future<Map<String, dynamic>> getHAR() #

Returns HAR log that contains all known network requests.

Returns: A HAR log. See HAR specification for details.

Future<Map<String, dynamic>> getHAR() {
 if (_devtools_network == null) _throwNotAvailable();

 var completer = new ChromeCompleter<Map<String, dynamic>>.oneArg(mapify);
 _devtools_network.callMethod('getHAR', [completer.callback]);
 return completer.future;
}