Navigator#
Annotations: @Native.new("Navigator")
Inheritance
Object → NavigatorConcurrentHardware → Navigator
Implemented types
Properties#
appCodeName no setter override#
Implementation
String get appCodeName native;
appName no setter override#
Implementation
String get appName native;
appVersion no setter override#
Implementation
String get appVersion native;
budget no setter#
Implementation
_BudgetService? get budget native;
clipboard no setter#
Implementation
_Clipboard? get clipboard native;
connection no setter#
Implementation
NetworkInformation? get connection native;
cookieEnabled no setter override#
Implementation
@Unstable()
bool? get cookieEnabled native;
credentials no setter#
Implementation
CredentialsContainer? get credentials native;
dartEnabled no setter override#
Implementation
bool? get dartEnabled native;
deviceMemory no setter#
Implementation
num? get deviceMemory native;
doNotTrack no setter#
Implementation
String? get doNotTrack native;
geolocation no setter#
Implementation
@Unstable()
Geolocation get geolocation native;
hardwareConcurrency no setter inherited#
Inherited from NavigatorConcurrentHardware.
Implementation
int? get hardwareConcurrency native;
hashCode no setter inherited#
Inherited from Interceptor.
Implementation
int get hashCode => Primitives.objectHashCode(this);
language no setter override#
Implementation
String get language =>
JS('String', '#.language || #.userLanguage', this, this);
languages no setter override#
Implementation
List<String>? get languages native;
maxTouchPoints no setter#
Implementation
int? get maxTouchPoints native;
mediaCapabilities no setter#
Implementation
MediaCapabilities? get mediaCapabilities native;
mediaDevices no setter#
Implementation
MediaDevices? get mediaDevices native;
mediaSession no setter#
Implementation
MediaSession? get mediaSession native;
mimeTypes no setter#
Implementation
MimeTypeArray? get mimeTypes native;
nfc no setter#
Implementation
_NFC? get nfc native;
onLine no setter override#
Implementation
@Unstable()
bool? get onLine native;
permissions no setter#
Implementation
Permissions? get permissions native;
persistentStorage no setter#
Implementation
@JSName('webkitPersistentStorage')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
DeprecatedStorageQuota? get persistentStorage native;
platform no setter override#
Implementation
String? get platform native;
presentation no setter#
Implementation
Presentation? get presentation native;
product no setter override#
Implementation
@Unstable()
String get product native;
productSub no setter#
Implementation
@Unstable()
String? get productSub native;
runtimeType no setter inherited#
Inherited from Interceptor.
Implementation
Type get runtimeType =>
getRuntimeTypeOfInterceptorNotArray(getInterceptor(this), this);
serviceWorker no setter#
Implementation
ServiceWorkerContainer? get serviceWorker native;
storage no setter#
Implementation
StorageManager? get storage native;
temporaryStorage no setter#
Implementation
@JSName('webkitTemporaryStorage')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
DeprecatedStorageQuota? get temporaryStorage native;
userAgent no setter override#
Implementation
String get userAgent native;
vendor no setter#
Implementation
@Unstable()
String get vendor native;
vendorSub no setter#
Implementation
@Unstable()
String get vendorSub native;
vr no setter#
Implementation
VR? get vr native;
webdriver no setter override#
Implementation
bool? get webdriver native;
Methods#
cancelKeyboardLock()#
Implementation
void cancelKeyboardLock() native;
getBattery()#
Implementation
Future getBattery() => promiseToFuture(JS("", "#.getBattery()", this));
getGamepads()#
Implementation
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()#
Implementation
Future<RelatedApplication> getInstalledRelatedApps() =>
promiseToFuture<RelatedApplication>(
JS("creates:RelatedApplication;", "#.getInstalledRelatedApps()", this),
);
getUserMedia()#
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()#
Implementation
Future getVRDisplays() =>
promiseToFuture(JS("creates:VRDisplay;", "#.getVRDisplays()", this));
noSuchMethod() inherited#
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()#
Implementation
@Unstable()
void registerProtocolHandler(String scheme, String url, String title) native;
requestKeyboardLock()#
Implementation
Future requestKeyboardLock([List<String>? keyCodes]) {
if (keyCodes != null) {
List keyCodes_1 = convertDartToNative_StringArray(keyCodes);
return _requestKeyboardLock_1(keyCodes_1);
}
return _requestKeyboardLock_2();
}
requestMediaKeySystemAccess()#
Implementation
Future requestMediaKeySystemAccess(
String keySystem,
List<Map> supportedConfigurations,
) => promiseToFuture(
JS(
"creates:MediaKeySystemAccess;",
"#.requestMediaKeySystemAccess(#, #)",
this,
keySystem,
supportedConfigurations,
),
);
requestMidiAccess()#
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()#
Implementation
bool sendBeacon(String url, Object? data) native;
share()#
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#
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#
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
bool operator ==(Object other) => identical(this, other);