Navigator
LogoDart

Navigator#

Annotations: @Native.new("Navigator")

Inheritance

Object → NavigatorConcurrentHardwareNavigator

Properties#

appCodeName no setter override#

String get appCodeName
Implementation
String get appCodeName native;

appName no setter override#

String get appName
Implementation
String get appName native;

appVersion no setter override#

String get appVersion
Implementation
String get appVersion native;

budget no setter#

_BudgetService? get budget
Implementation
_BudgetService? get budget native;

clipboard no setter#

_Clipboard? get clipboard
Implementation
_Clipboard? get clipboard native;

connection no setter#

NetworkInformation? get connection
Implementation
NetworkInformation? get connection native;

cookieEnabled no setter override#

bool? get cookieEnabled
Implementation
@Unstable()
bool? get cookieEnabled native;

credentials no setter#

CredentialsContainer? get credentials
Implementation
CredentialsContainer? get credentials native;

dartEnabled no setter override#

bool? get dartEnabled
Implementation
bool? get dartEnabled native;

deviceMemory no setter#

num? get deviceMemory
Implementation
num? get deviceMemory native;

doNotTrack no setter#

String? get doNotTrack
Implementation
String? get doNotTrack native;

geolocation no setter#

Geolocation get geolocation
Implementation
@Unstable()
Geolocation get geolocation native;

hardwareConcurrency no setter inherited#

int? get hardwareConcurrency

Inherited from NavigatorConcurrentHardware.

Implementation
int? get hardwareConcurrency native;

hashCode no setter inherited#

int get hashCode

Inherited from Interceptor.

Implementation
int get hashCode => Primitives.objectHashCode(this);

language no setter override#

String get language
Implementation
String get language =>
    JS('String', '#.language || #.userLanguage', this, this);

languages no setter override#

List<String>? get languages
Implementation
List<String>? get languages native;

maxTouchPoints no setter#

int? get maxTouchPoints
Implementation
int? get maxTouchPoints native;

mediaCapabilities no setter#

MediaCapabilities? get mediaCapabilities
Implementation
MediaCapabilities? get mediaCapabilities native;

mediaDevices no setter#

MediaDevices? get mediaDevices
Implementation
MediaDevices? get mediaDevices native;

mediaSession no setter#

MediaSession? get mediaSession
Implementation
MediaSession? get mediaSession native;

mimeTypes no setter#

MimeTypeArray? get mimeTypes
Implementation
MimeTypeArray? get mimeTypes native;

nfc no setter#

_NFC? get nfc
Implementation
_NFC? get nfc native;

onLine no setter override#

bool? get onLine
Implementation
@Unstable()
bool? get onLine native;

permissions no setter#

Permissions? get permissions
Implementation
Permissions? get permissions native;

persistentStorage no setter#

DeprecatedStorageQuota? get persistentStorage
Implementation
@JSName('webkitPersistentStorage')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
DeprecatedStorageQuota? get persistentStorage native;

platform no setter override#

String? get platform
Implementation
String? get platform native;

presentation no setter#

Presentation? get presentation
Implementation
Presentation? get presentation native;

product no setter override#

String get product
Implementation
@Unstable()
String get product native;

productSub no setter#

String? get productSub
Implementation
@Unstable()
String? get productSub native;

runtimeType no setter inherited#

Type get runtimeType

Inherited from Interceptor.

Implementation
Type get runtimeType =>
    getRuntimeTypeOfInterceptorNotArray(getInterceptor(this), this);

serviceWorker no setter#

ServiceWorkerContainer? get serviceWorker
Implementation
ServiceWorkerContainer? get serviceWorker native;

storage no setter#

StorageManager? get storage
Implementation
StorageManager? get storage native;

temporaryStorage no setter#

DeprecatedStorageQuota? get temporaryStorage
Implementation
@JSName('webkitTemporaryStorage')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
DeprecatedStorageQuota? get temporaryStorage native;

userAgent no setter override#

String get userAgent
Implementation
String get userAgent native;

vendor no setter#

String get vendor
Implementation
@Unstable()
String get vendor native;

vendorSub no setter#

String get vendorSub
Implementation
@Unstable()
String get vendorSub native;

vr no setter#

VR? get vr
Implementation
VR? get vr native;

webdriver no setter override#

bool? get webdriver
Implementation
bool? get webdriver native;

Methods#

cancelKeyboardLock()#

void cancelKeyboardLock()
Implementation
void cancelKeyboardLock() native;

getBattery()#

Future<dynamic> getBattery()
Implementation
Future getBattery() => promiseToFuture(JS("", "#.getBattery()", this));

getGamepads()#

List<Gamepad?> getGamepads()
Implementation
List<Gamepad?> getGamepads() {
  var gamepadList = _getGamepads();

  &#47;&#47; If no prototype we need one for the world to hookup to the proper Dart class.
  var jsProto = JS('', '#.prototype', gamepadList);
  if (jsProto == null) {
    JS('', '#.prototype = Object.create(null)', gamepadList);
  }

  applyExtension('GamepadList', gamepadList);
  return gamepadList;
}

getInstalledRelatedApps()#

Future<RelatedApplication> getInstalledRelatedApps()
Implementation
Future<RelatedApplication> getInstalledRelatedApps() =>
    promiseToFuture<RelatedApplication>(
      JS("creates:RelatedApplication;", "#.getInstalledRelatedApps()", this),
    );

getUserMedia()#

Future<MediaStream> getUserMedia({ dynamic audio = false, dynamic video = false, });

Gets a stream (video and or audio) from the local computer.

Use MediaStream.supported to check if this is supported by the current platform. The arguments audio and video default to false (stream does not use audio or video, respectively).

Simple example usage:

window.navigator.getUserMedia(audio: true, video: true).then((stream) {
  var video = new VideoElement()
    ..autoplay = true
    ..src = Url.createObjectUrlFromStream(stream);
  document.body.append(video);
});

The user can also pass in Maps to the audio or video parameters to specify mandatory and optional constraints for the media stream. Not passing in a map, but passing in true will provide a MediaStream with audio or video capabilities, but without any additional constraints. The particular constraint names for audio and video are still in flux, but as of this writing, here is an example providing more constraints.

window.navigator.getUserMedia(
    audio: true,
    video: {'mandatory':
               { 'minAspectRatio': 1.333, 'maxAspectRatio': 1.334 },
            'optional':
               [{ 'minFrameRate': 60 },
                { 'maxWidth': 640 }]
});

See also:

Implementation
@SupportedBrowser(SupportedBrowser.CHROME)
Future<MediaStream> getUserMedia({audio = false, video = false}) {
  var completer = new Completer<MediaStream>();
  var options = {'audio': audio, 'video': video};
  _ensureGetUserMedia();
  this._getUserMedia(
    convertDartToNative_SerializedScriptValue(options),
    (stream) {
      completer.complete(stream);
    },
    (error) {
      completer.completeError(error);
    },
  );
  return completer.future;
}

getVRDisplays()#

Future<dynamic> getVRDisplays()
Implementation
Future getVRDisplays() =>
    promiseToFuture(JS("creates:VRDisplay;", "#.getVRDisplays()", this));

noSuchMethod() inherited#

dynamic noSuchMethod(Invocation invocation)

Invoked when a nonexistent method or property is accessed.

A dynamic member invocation can attempt to call a member which doesn't exist on the receiving object. Example:

dynamic object = 1;
object.add(42); // Statically allowed, run-time error

This invalid code will invoke the noSuchMethod method of the integer 1 with an Invocation representing the .add(42) call and arguments (which then throws).

Classes can override noSuchMethod to provide custom behavior for such invalid dynamic invocations.

A class with a non-default noSuchMethod invocation can also omit implementations for members of its interface. Example:

class MockList<T> implements List<T> {
  noSuchMethod(Invocation invocation) {
    log(invocation);
    super.noSuchMethod(invocation); // Will throw.
  }
}
void main() {
  MockList().add(42);
}

This code has no compile-time warnings or errors even though the MockList class has no concrete implementation of any of the List interface methods. Calls to List methods are forwarded to noSuchMethod, so this code will log an invocation similar to Invocation.method(#add, [42]) and then throw.

If a value is returned from noSuchMethod, it becomes the result of the original invocation. If the value is not of a type that can be returned by the original invocation, a type error occurs at the invocation.

The default behavior is to throw a NoSuchMethodError.

Inherited from Interceptor.

Implementation
dynamic noSuchMethod(Invocation invocation) {
  throw NoSuchMethodError.withInvocation(this, invocation);
}

registerProtocolHandler()#

void registerProtocolHandler(String scheme, String url, String title)
Implementation
@Unstable()
void registerProtocolHandler(String scheme, String url, String title) native;

requestKeyboardLock()#

Future<dynamic> requestKeyboardLock([ List<String>? keyCodes])
Implementation
Future requestKeyboardLock([List<String>? keyCodes]) {
  if (keyCodes != null) {
    List keyCodes_1 = convertDartToNative_StringArray(keyCodes);
    return _requestKeyboardLock_1(keyCodes_1);
  }
  return _requestKeyboardLock_2();
}

requestMediaKeySystemAccess()#

Future<dynamic> requestMediaKeySystemAccess( String keySystem, List<Map<dynamic, dynamic>> supportedConfigurations, );
Implementation
Future requestMediaKeySystemAccess(
  String keySystem,
  List<Map> supportedConfigurations,
) => promiseToFuture(
  JS(
    "creates:MediaKeySystemAccess;",
    "#.requestMediaKeySystemAccess(#, #)",
    this,
    keySystem,
    supportedConfigurations,
  ),
);

requestMidiAccess()#

Future<dynamic> requestMidiAccess([ Map<dynamic, dynamic>? options])
Implementation
@JSName('requestMIDIAccess')
Future requestMidiAccess([Map? options]) {
  var options_dict = null;
  if (options != null) {
    options_dict = convertDartToNative_Dictionary(options);
  }
  return promiseToFuture(
    JS("", "#.requestMIDIAccess(#)", this, options_dict),
  );
}

sendBeacon()#

bool sendBeacon(String url, Object? data)
Implementation
bool sendBeacon(String url, Object? data) native;

share()#

Future<dynamic> share([ Map<dynamic, dynamic>? data])
Implementation
Future share([Map? data]) {
  var data_dict = null;
  if (data != null) {
    data_dict = convertDartToNative_Dictionary(data);
  }
  return promiseToFuture(JS("", "#.share(#)", this, data_dict));
}

toString() inherited#

String toString()

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.

Inherited from Interceptor.

Implementation
String toString() => Primitives.objectToHumanReadableString(this);

Operators#

operator ==() inherited#

bool operator ==(Object other)

The equality operator.

The default behavior for all Objects is to return true if and only if this object and other are the same object.

Override this method to specify a different equality relation on a class. The overriding method must still be an equivalence relation. That is, it must be:

  • Total: It must return a boolean for all arguments. It should never throw.

  • Reflexive: For all objects o, o == o must be true.

  • Symmetric: For all objects o1 and o2, o1 == o2 and o2 == o1 must either both be true, or both be false.

  • Transitive: For all objects o1, o2, and o3, if o1 == o2 and o2 == o3 are true, then o1 == o3 must be true.

The method should also be consistent over time, so whether two objects are equal should only change if at least one of the objects was modified.

If a subclass overrides the equality operator, it should override the hashCode method as well to maintain consistency.

Inherited from Interceptor.

Implementation
bool operator ==(Object other) => identical(this, other);