Appearance
Navigator ​
class Navigator extends NavigatorConcurrentHardware implements NavigatorCookies, NavigatorID, NavigatorLanguage, NavigatorOnLine, NavigatorAutomationInformationAnnotations: @Native.new("Navigator")
Inheritance
Object → NavigatorConcurrentHardware → Navigator
Implemented types
Properties ​
appCodeName no setter override ​
String get appCodeNameImplementation
dart
String get appCodeName native;appName no setter override ​
String get appNameImplementation
dart
String get appName native;appVersion no setter override ​
String get appVersionImplementation
dart
String get appVersion native;budget no setter ​
_BudgetService? get budgetImplementation
dart
_BudgetService? get budget native;clipboard no setter ​
_Clipboard? get clipboardImplementation
dart
_Clipboard? get clipboard native;connection no setter ​
NetworkInformation? get connectionImplementation
dart
NetworkInformation? get connection native;cookieEnabled no setter override ​
bool? get cookieEnabledImplementation
dart
@Unstable()
bool? get cookieEnabled native;credentials no setter ​
CredentialsContainer? get credentialsImplementation
dart
CredentialsContainer? get credentials native;dartEnabled no setter override ​
bool? get dartEnabledImplementation
dart
bool? get dartEnabled native;deviceMemory no setter ​
num? get deviceMemoryImplementation
dart
num? get deviceMemory native;doNotTrack no setter ​
String? get doNotTrackImplementation
dart
String? get doNotTrack native;geolocation no setter ​
Geolocation get geolocationImplementation
dart
@Unstable()
Geolocation get geolocation native;hardwareConcurrency no setter inherited ​
int? get hardwareConcurrencyInherited from NavigatorConcurrentHardware.
Implementation
dart
int? get hardwareConcurrency native;hashCode no setter inherited ​
int get hashCodeInherited from Interceptor.
Implementation
dart
int get hashCode => Primitives.objectHashCode(this);language no setter override ​
String get languageImplementation
dart
String get language =>
JS('String', '#.language || #.userLanguage', this, this);languages no setter override ​
Implementation
dart
List<String>? get languages native;maxTouchPoints no setter ​
int? get maxTouchPointsImplementation
dart
int? get maxTouchPoints native;mediaCapabilities no setter ​
MediaCapabilities? get mediaCapabilitiesImplementation
dart
MediaCapabilities? get mediaCapabilities native;mediaDevices no setter ​
MediaDevices? get mediaDevicesImplementation
dart
MediaDevices? get mediaDevices native;mediaSession no setter ​
MediaSession? get mediaSessionImplementation
dart
MediaSession? get mediaSession native;mimeTypes no setter ​
MimeTypeArray? get mimeTypesImplementation
dart
MimeTypeArray? get mimeTypes native;nfc no setter ​
_NFC? get nfcImplementation
dart
_NFC? get nfc native;onLine no setter override ​
bool? get onLineImplementation
dart
@Unstable()
bool? get onLine native;permissions no setter ​
Permissions? get permissionsImplementation
dart
Permissions? get permissions native;persistentStorage no setter ​
DeprecatedStorageQuota? get persistentStorageImplementation
dart
@JSName('webkitPersistentStorage')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
DeprecatedStorageQuota? get persistentStorage native;platform no setter override ​
String? get platformImplementation
dart
String? get platform native;presentation no setter ​
Presentation? get presentationImplementation
dart
Presentation? get presentation native;product no setter override ​
String get productImplementation
dart
@Unstable()
String get product native;productSub no setter ​
String? get productSubImplementation
dart
@Unstable()
String? get productSub native;runtimeType no setter inherited ​
Type get runtimeTypeInherited from Interceptor.
Implementation
dart
Type get runtimeType =>
getRuntimeTypeOfInterceptorNotArray(getInterceptor(this), this);serviceWorker no setter ​
ServiceWorkerContainer? get serviceWorkerImplementation
dart
ServiceWorkerContainer? get serviceWorker native;storage no setter ​
StorageManager? get storageImplementation
dart
StorageManager? get storage native;temporaryStorage no setter ​
DeprecatedStorageQuota? get temporaryStorageImplementation
dart
@JSName('webkitTemporaryStorage')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
DeprecatedStorageQuota? get temporaryStorage native;userAgent no setter override ​
String get userAgentImplementation
dart
String get userAgent native;vendor no setter ​
String get vendorImplementation
dart
@Unstable()
String get vendor native;vendorSub no setter ​
String get vendorSubImplementation
dart
@Unstable()
String get vendorSub native;vr no setter ​
VR? get vrImplementation
dart
VR? get vr native;webdriver no setter override ​
bool? get webdriverImplementation
dart
bool? get webdriver native;Methods ​
cancelKeyboardLock() ​
void cancelKeyboardLock()Implementation
dart
void cancelKeyboardLock() native;getBattery() ​
Future<dynamic> getBattery()Implementation
dart
Future getBattery() => promiseToFuture(JS("", "#.getBattery()", this));getGamepads() ​
Implementation
dart
List<Gamepad?> getGamepads() {
var gamepadList = _getGamepads();
// 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
dart
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:
dart
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.
dart
window.navigator.getUserMedia(
audio: true,
video: {'mandatory':
{ 'minAspectRatio': 1.333, 'maxAspectRatio': 1.334 },
'optional':
[{ 'minFrameRate': 60 },
{ 'maxWidth': 640 }]
});See also:
Implementation
dart
@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
dart
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:
dart
dynamic object = 1;
object.add(42); // Statically allowed, run-time errorThis 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:
dart
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
dart
dynamic noSuchMethod(Invocation invocation) {
throw NoSuchMethodError.withInvocation(this, invocation);
}registerProtocolHandler() ​
Implementation
dart
@Unstable()
void registerProtocolHandler(String scheme, String url, String title) native;requestKeyboardLock() ​
Implementation
dart
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
dart
Future requestMediaKeySystemAccess(
String keySystem,
List<Map> supportedConfigurations,
) => promiseToFuture(
JS(
"creates:MediaKeySystemAccess;",
"#.requestMediaKeySystemAccess(#, #)",
this,
keySystem,
supportedConfigurations,
),
);requestMidiAccess() ​
Implementation
dart
@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() ​
Implementation
dart
bool sendBeacon(String url, Object? data) native;share() ​
Implementation
dart
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
dart
String toString() => Primitives.objectToHumanReadableString(this);Operators ​
operator ==() inherited ​
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 == omust be true.Symmetric: For all objects
o1ando2,o1 == o2ando2 == o1must either both be true, or both be false.Transitive: For all objects
o1,o2, ando3, ifo1 == o2ando2 == o3are true, theno1 == o3must 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
dart
bool operator ==(Object other) => identical(this, other);