CINXE.COM
dart:js_util library - Dart API
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no"> <meta name="description" content="dart:js_util library API docs, for the Dart programming language."> <title>dart:js_util library - Dart API</title> <link rel="canonical" href="https://api.dart.dev/dart-js_util/dart-js_util-library.html"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" rel="stylesheet"> <link rel="stylesheet" href="../static-assets/github.css?v1"> <link rel="stylesheet" href="../static-assets/styles.css?v1"> <link rel="icon" href="../static-assets/favicon.png?v1"> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-VVQ8908SJ5"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-VVQ8908SJ5'); </script> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preload" href="https://fonts.googleapis.com/css2?family=Google+Sans+Text:wght@400&family=Google+Sans:wght@500&display=swap" as="style"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Google+Sans+Text:wght@400&family=Google+Sans:wght@500&display=swap"> <link rel="stylesheet" href="https://www.gstatic.com/glue/cookienotificationbar/cookienotificationbar.min.css"> </head> <body data-base-href="../" data-using-base-href="false" class="light-theme"> <div id="overlay-under-drawer"></div> <header id="title"> <span id="sidenav-left-toggle" class="material-symbols-outlined" role="button" tabindex="0">menu</span> <ol class="breadcrumbs gt-separated dark hidden-xs"> <li><a href="../index.html">Dart</a></li> <li class="self-crumb">dart:js_util</li> </ol> <div class="self-name">dart:js_util</div> <form class="search navbar-right" role="search"> <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search..."> </form> <div class="toggle" id="theme-button" title="Toggle brightness"> <label for="theme"> <input type="checkbox" id="theme" value="light-theme"> <span id="dark-theme-button" class="material-symbols-outlined"> dark_mode </span> <span id="light-theme-button" class="material-symbols-outlined"> light_mode </span> </label> </div> </header> <main> <div id="dartdoc-main-content" class="main-content" data-above-sidebar="" data-below-sidebar="dart-js_util/dart-js_util-library-sidebar.html"> <div> <div id="external-links" class="btn-group"><a title="View source code" class="source-link" href="https://github.com/dart-lang/sdk/blob/88c9758ef131d430d8ce595c6bfb4c90574d3ddd/sdk/lib/js_util/js_util.dart#L17"><span class="material-symbols-outlined">description</span></a></div> <h1> <span class="kind-library">dart:js_util</span> library </h1> </div> <section class="desc markdown"> <p>Utility methods to manipulate <code>package:js</code> annotated JavaScript interop objects in cases where the name to call is not known at runtime.</p> <div class="markdown-alert markdown-alert-note"> <p class="markdown-alert-title">Note</p> <p>You should usually use <code>dart:js_interop</code> instead of this library. To learn more, check out the <a href="https://dart.dev/interop/js-interop">JS interop documentation</a>.</p> </div> <p>You should only use these methods when the same effect cannot be achieved with <code>@JS()</code> annotations.</p> </section> <section class="summary offset-anchor" id="properties"> <h2>Properties</h2> <dl class="properties"> <dt id="globalThis" class="property"> <span class="name"><a href="../dart-js_util/globalThis.html">globalThis</a></span> <span class="signature">→ <a href="../dart-core/Object-class.html">Object</a></span> </dt> <dd> <div class="features"><span class="feature">no setter</span></div> </dd> <dt id="objectPrototype" class="property"> <span class="name"><a href="../dart-js_util/objectPrototype.html">objectPrototype</a></span> <span class="signature">→ <a href="../dart-core/Object-class.html">Object</a>?</span> </dt> <dd> Returns the <code>Object</code> prototype. Equivalent to <code>Object.prototype</code>. <div class="features"><span class="feature">no setter</span></div> </dd> </dl> </section> <section class="summary offset-anchor" id="functions"> <h2>Functions</h2> <dl class="callables"> <dt id="add" class="callable"> <span class="name"><a href="../dart-js_util/add.html">add</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="add-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="add-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> Perform JavaScript addition (<code>+</code>) on two values. </dd> <dt id="allowInterop" class="callable"> <span class="name"><a href="../dart-js_util/allowInterop.html">allowInterop</a></span><span class="signature"><<wbr><span class="type-parameter">F extends <a href="../dart-core/Function-class.html">Function</a></span>></span><span class="signature">(<wbr><span class="parameter" id="allowInterop-param-f"><span class="type-annotation">F</span> <span class="parameter-name">f</span></span>) <span class="returntype parameter">→ F</span> </span> </dt> <dd> Returns a wrapper around function <code>f</code> that can be called from JavaScript using <code>package:js</code> JavaScript interop. </dd> <dt id="allowInteropCaptureThis" class="callable"> <span class="name"><a href="../dart-js_util/allowInteropCaptureThis.html">allowInteropCaptureThis</a></span><span class="signature">(<wbr><span class="parameter" id="allowInteropCaptureThis-param-f"><span class="type-annotation"><a href="../dart-core/Function-class.html">Function</a></span> <span class="parameter-name">f</span></span>) <span class="returntype parameter">→ <a href="../dart-core/Function-class.html">Function</a></span> </span> </dt> <dd> Returns a wrapper around function <code>f</code> that can be called from JavaScript using <code>package:js</code> JavaScript interop, passing JavaScript <code>this</code> as the first argument. </dd> <dt id="and" class="callable"> <span class="name"><a href="../dart-js_util/and.html">and</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="and-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="and-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> Perform JavaScript logical and comparison (<code>&&</code>) of two expressions. </dd> <dt id="callConstructor" class="callable"> <span class="name"><a href="../dart-js_util/callConstructor.html">callConstructor</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="callConstructor-param-constr"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">constr</span>, </span><span class="parameter" id="callConstructor-param-arguments"><span class="type-annotation"><a href="../dart-core/List-class.html">List</a><span class="signature"><<wbr><span class="type-parameter"><a href="../dart-core/Object-class.html">Object</a>?</span>></span>?</span> <span class="parameter-name">arguments</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> </dd> <dt id="callMethod" class="callable"> <span class="name"><a href="../dart-js_util/callMethod.html">callMethod</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="callMethod-param-o"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">o</span>, </span><span class="parameter" id="callMethod-param-method"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">method</span>, </span><span class="parameter" id="callMethod-param-args"><span class="type-annotation"><a href="../dart-core/List-class.html">List</a><span class="signature"><<wbr><span class="type-parameter"><a href="../dart-core/Object-class.html">Object</a>?</span>></span></span> <span class="parameter-name">args</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> </dd> <dt id="createDartExport" class="callable"> <span class="name"><a href="../dart-js_util/createDartExport.html">createDartExport</a></span><span class="signature"><<wbr><span class="type-parameter">T extends <a href="../dart-core/Object-class.html">Object</a></span>></span><span class="signature">(<wbr><span class="parameter" id="createDartExport-param-dartObject"><span class="type-annotation">T</span> <span class="parameter-name">dartObject</span></span>) <span class="returntype parameter">→ <a href="../dart-core/Object-class.html">Object</a></span> </span> </dt> <dd> Given a Dart object that is marked exportable, creates a JS object literal that forwards to that Dart class. Look at the <code>@JSExport</code> annotation to determine what constitutes "exportable" for a Dart class. The object literal will be a map of export names (which are either the written instance member names or their rename) to their respective Dart instance members. </dd> <dt id="createStaticInteropMock" class="callable"> <span class="name"><a href="../dart-js_util/createStaticInteropMock.html">createStaticInteropMock</a></span><span class="signature"><<wbr><span class="type-parameter">T extends <a href="../dart-core/Object-class.html">Object</a></span>, <span class="type-parameter">U extends <a href="../dart-core/Object-class.html">Object</a></span>></span><span class="signature">(<wbr><span class="parameter" id="createStaticInteropMock-param-dartMock"><span class="type-annotation">U</span> <span class="parameter-name">dartMock</span>, [</span><span class="parameter" id="createStaticInteropMock-param-proto"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">proto</span> = <span class="default-value">null</span></span>]) <span class="returntype parameter">→ T</span> </span> </dt> <dd> Given a <code>@staticInterop</code> type T and an instance <code>dartMock</code> of a Dart class U that implements the external extension members of T, creates a forwarding mock. </dd> <dt id="dartify" class="callable"> <span class="name"><a href="../dart-js_util/dartify.html">dartify</a></span><span class="signature">(<wbr><span class="parameter" id="dartify-param-o"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">o</span></span>) <span class="returntype parameter">→ <a href="../dart-core/Object-class.html">Object</a>?</span> </span> </dt> <dd> Effectively the inverse of <a href="../dart-js_util/jsify.html">jsify</a>, <a href="../dart-js_util/dartify.html">dartify</a> Takes a JavaScript object, and converts it to a Dart based object. Only JS primitives, arrays, or 'map' like JS objects are supported. </dd> <dt id="delete" class="callable"> <span class="name"><a href="../dart-js_util/delete.html">delete</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="delete-param-o"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">o</span>, </span><span class="parameter" id="delete-param-property"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">property</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Perform JavaScript delete operator (<code>delete</code>) on the given property of the given object. </dd> <dt id="divide" class="callable"> <span class="name"><a href="../dart-js_util/divide.html">divide</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="divide-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="divide-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> Perform JavaScript division (<code>/</code>) on two values. </dd> <dt id="equal" class="callable"> <span class="name"><a href="../dart-js_util/equal.html">equal</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="equal-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="equal-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Perform JavaScript equality comparison (<code>==</code>) on two values. </dd> <dt id="exponentiate" class="callable"> <span class="name"><a href="../dart-js_util/exponentiate.html">exponentiate</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="exponentiate-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="exponentiate-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> Perform JavaScript exponentiation (<code>**</code>) on two values. </dd> <dt id="getProperty" class="callable"> <span class="name"><a href="../dart-js_util/getProperty.html">getProperty</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="getProperty-param-o"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">o</span>, </span><span class="parameter" id="getProperty-param-name"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">name</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> </dd> <dt id="greaterThan" class="callable"> <span class="name"><a href="../dart-js_util/greaterThan.html">greaterThan</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="greaterThan-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="greaterThan-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Perform JavaScript greater than comparison (<code>></code>) of two values. </dd> <dt id="greaterThanOrEqual" class="callable"> <span class="name"><a href="../dart-js_util/greaterThanOrEqual.html">greaterThanOrEqual</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="greaterThanOrEqual-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="greaterThanOrEqual-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Perform JavaScript greater than or equal comparison (<code>>=</code>) of two values. </dd> <dt id="hasProperty" class="callable"> <span class="name"><a href="../dart-js_util/hasProperty.html">hasProperty</a></span><span class="signature">(<wbr><span class="parameter" id="hasProperty-param-o"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">o</span>, </span><span class="parameter" id="hasProperty-param-name"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">name</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> </dd> <dt id="instanceof" class="callable"> <span class="name"><a href="../dart-js_util/instanceof.html">instanceof</a></span><span class="signature">(<wbr><span class="parameter" id="instanceof-param-o"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">o</span>, </span><span class="parameter" id="instanceof-param-type"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">type</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Check whether <code>o</code> is an instance of <code>type</code>. </dd> <dt id="instanceOfString" class="callable"> <span class="name"><a href="../dart-js_util/instanceOfString.html">instanceOfString</a></span><span class="signature">(<wbr><span class="parameter" id="instanceOfString-param-element"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">element</span>, </span><span class="parameter" id="instanceOfString-param-objectType"><span class="type-annotation"><a href="../dart-core/String-class.html">String</a></span> <span class="parameter-name">objectType</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Like <a href="../dart-js_util/instanceof.html">instanceof</a> only takes a <a href="../dart-core/String-class.html">String</a> for the object name instead of a constructor object. </dd> <dt id="isJavaScriptArray" class="callable"> <span class="name"><a href="../dart-js_util/isJavaScriptArray.html">isJavaScriptArray</a></span><span class="signature">(<wbr><span class="parameter" id="isJavaScriptArray-param-value"><span class="type-annotation">dynamic</span> <span class="parameter-name">value</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Returns <code>true</code> if a given object is a JavaScript array. </dd> <dt id="isJavaScriptSimpleObject" class="callable"> <span class="name"><a href="../dart-js_util/isJavaScriptSimpleObject.html">isJavaScriptSimpleObject</a></span><span class="signature">(<wbr><span class="parameter" id="isJavaScriptSimpleObject-param-value"><span class="type-annotation">dynamic</span> <span class="parameter-name">value</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Returns <code>true</code> if a given object is a simple JavaScript object. </dd> <dt id="isTruthy" class="callable"> <span class="name"><a href="../dart-js_util/isTruthy.html">isTruthy</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="isTruthy-param-o"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">o</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Determines if the given object is truthy or falsy. </dd> <dt id="jsify" class="callable"> <span class="name"><a href="../dart-js_util/jsify.html">jsify</a></span><span class="signature">(<wbr><span class="parameter" id="jsify-param-object"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">object</span></span>) <span class="returntype parameter">→ dynamic</span> </span> </dt> <dd> Recursively converts a JSON-like collection to JavaScript compatible representation. </dd> <dt id="lessThan" class="callable"> <span class="name"><a href="../dart-js_util/lessThan.html">lessThan</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="lessThan-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="lessThan-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Perform JavaScript less than comparison (<code><</code>) of two values. </dd> <dt id="lessThanOrEqual" class="callable"> <span class="name"><a href="../dart-js_util/lessThanOrEqual.html">lessThanOrEqual</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="lessThanOrEqual-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="lessThanOrEqual-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Perform JavaScript less than or equal comparison (<code><=</code>) of two values. </dd> <dt id="modulo" class="callable"> <span class="name"><a href="../dart-js_util/modulo.html">modulo</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="modulo-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="modulo-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> Perform JavaScript remainder (<code>%</code>) on two values. </dd> <dt id="multiply" class="callable"> <span class="name"><a href="../dart-js_util/multiply.html">multiply</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="multiply-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="multiply-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> Perform JavaScript multiplication (<code>*</code>) on two values. </dd> <dt id="newObject" class="callable"> <span class="name"><a href="../dart-js_util/newObject.html">newObject</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> </dd> <dt id="not" class="callable"> <span class="name"><a href="../dart-js_util/not.html">not</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="not-param-o"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">o</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> Perform JavaScript logical not (<code>!</code>) on the given object. </dd> <dt id="notEqual" class="callable"> <span class="name"><a href="../dart-js_util/notEqual.html">notEqual</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="notEqual-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="notEqual-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Perform JavaScript inequality comparison (<code>!=</code>) on two values. </dd> <dt id="objectGetPrototypeOf" class="callable"> <span class="name"><a href="../dart-js_util/objectGetPrototypeOf.html">objectGetPrototypeOf</a></span><span class="signature">(<wbr><span class="parameter" id="objectGetPrototypeOf-param-object"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">object</span></span>) <span class="returntype parameter">→ <a href="../dart-core/Object-class.html">Object</a>?</span> </span> </dt> <dd> Returns the prototype of a given object. Equivalent to <code>Object.getPrototypeOf</code>. </dd> <dt id="objectKeys" class="callable"> <span class="name"><a href="../dart-js_util/objectKeys.html">objectKeys</a></span><span class="signature">(<wbr><span class="parameter" id="objectKeys-param-object"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">object</span></span>) <span class="returntype parameter">→ <a href="../dart-core/List-class.html">List</a><span class="signature"><<wbr><span class="type-parameter"><a href="../dart-core/Object-class.html">Object</a>?</span>></span></span> </span> </dt> <dd> Returns the keys for a given object. Equivalent to <code>Object.keys(object)</code>. </dd> <dt id="or" class="callable"> <span class="name"><a href="../dart-js_util/or.html">or</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="or-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="or-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> Perform JavaScript logical or comparison (<code>||</code>) of two expressions. </dd> <dt id="promiseToFuture" class="callable"> <span class="name"><a href="../dart-js_util/promiseToFuture.html">promiseToFuture</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="promiseToFuture-param-jsPromise"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">jsPromise</span></span>) <span class="returntype parameter">→ <a href="../dart-async/Future-class.html">Future</a><span class="signature"><<wbr><span class="type-parameter">T</span>></span></span> </span> </dt> <dd> Converts a JavaScript Promise to a Dart <a href="../dart-async/Future-class.html">Future</a>. </dd> <dt id="setProperty" class="callable"> <span class="name"><a href="../dart-js_util/setProperty.html">setProperty</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="setProperty-param-o"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">o</span>, </span><span class="parameter" id="setProperty-param-name"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a></span> <span class="parameter-name">name</span>, </span><span class="parameter" id="setProperty-param-value"><span class="type-annotation">T?</span> <span class="parameter-name">value</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> </dd> <dt id="strictEqual" class="callable"> <span class="name"><a href="../dart-js_util/strictEqual.html">strictEqual</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="strictEqual-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="strictEqual-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Perform JavaScript strict equality comparison (<code>===</code>) on two values. </dd> <dt id="strictNotEqual" class="callable"> <span class="name"><a href="../dart-js_util/strictNotEqual.html">strictNotEqual</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="strictNotEqual-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="strictNotEqual-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Perform JavaScript strict inequality comparison (<code>!==</code>) on two values. </dd> <dt id="subtract" class="callable"> <span class="name"><a href="../dart-js_util/subtract.html">subtract</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="subtract-param-first"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">first</span>, </span><span class="parameter" id="subtract-param-second"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">second</span></span>) <span class="returntype parameter">→ T</span> </span> </dt> <dd> Perform JavaScript subtraction (<code>-</code>) on two values. </dd> <dt id="typeofEquals" class="callable"> <span class="name"><a href="../dart-js_util/typeofEquals.html">typeofEquals</a></span><span class="signature"><<wbr><span class="type-parameter">T</span>></span><span class="signature">(<wbr><span class="parameter" id="typeofEquals-param-o"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">o</span>, </span><span class="parameter" id="typeofEquals-param-type"><span class="type-annotation"><a href="../dart-core/String-class.html">String</a></span> <span class="parameter-name">type</span></span>) <span class="returntype parameter">→ <a href="../dart-core/bool-class.html">bool</a></span> </span> </dt> <dd> Perform JavaScript <code>typeof</code> operator on the given object and determine if the result is equal to the given type. Exposes the whole <code>typeof</code> equal expression to maximize browser optimization. </dd> <dt id="unsignedRightShift" class="callable"> <span class="name"><a href="../dart-js_util/unsignedRightShift.html">unsignedRightShift</a></span><span class="signature">(<wbr><span class="parameter" id="unsignedRightShift-param-leftOperand"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">leftOperand</span>, </span><span class="parameter" id="unsignedRightShift-param-rightOperand"><span class="type-annotation"><a href="../dart-core/Object-class.html">Object</a>?</span> <span class="parameter-name">rightOperand</span></span>) <span class="returntype parameter">→ <a href="../dart-core/num-class.html">num</a></span> </span> </dt> <dd> Perform JavaScript unsigned right shift operator (<code>>>></code>) on the given left operand by the amount specified by the given right operand. </dd> </dl> </section> <section class="summary offset-anchor" id="exceptions"> <h2>Exceptions / Errors</h2> <dl> <dt id="NullRejectionException"> <span class="name "><a href="../dart-js_util/NullRejectionException-class.html">NullRejectionException</a></span> </dt> <dd> Exception for when the promise is rejected with a <code>null</code> or <code>undefined</code> value. </dd> </dl> </section> </div> <!-- /.main-content --> <div id="dartdoc-sidebar-left" class="sidebar sidebar-offcanvas-left"> <!-- The search input and breadcrumbs below are only responsively visible at low resolutions. --> <header id="header-search-sidebar" class="hidden-l"> <form class="search-sidebar" role="search"> <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search..."> </form> </header> <ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav"> <li><a href="../index.html">Dart</a></li> <li class="self-crumb">dart:js_util</li> </ol> <h5><span class="package-name">Dart</span> <span class="package-kind">SDK</span></h5> <ol> <li class="section-title">Libraries</li> <li class="section-subtitle">Core</li> <li class="section-subitem"><a href="../dart-async/dart-async-library.html">dart:async</a></li> <li class="section-subitem"><a href="../dart-collection/dart-collection-library.html">dart:collection</a></li> <li class="section-subitem"><a href="../dart-convert/dart-convert-library.html">dart:convert</a></li> <li class="section-subitem"><a href="../dart-core/dart-core-library.html">dart:core</a></li> <li class="section-subitem"><a href="../dart-developer/dart-developer-library.html">dart:developer</a></li> <li class="section-subitem"><a href="../dart-math/dart-math-library.html">dart:math</a></li> <li class="section-subitem"><a href="../dart-typed_data/dart-typed_data-library.html">dart:typed_data</a></li> <li class="section-subtitle">VM</li> <li class="section-subitem"><a href="../dart-ffi/dart-ffi-library.html">dart:ffi</a></li> <li class="section-subitem"><a href="../dart-io/dart-io-library.html">dart:io</a></li> <li class="section-subitem"><a href="../dart-isolate/dart-isolate-library.html">dart:isolate</a></li> <li class="section-subitem"><a href="../dart-mirrors/dart-mirrors-library.html">dart:mirrors</a></li> <li class="section-subtitle">Web</li> <li class="section-subitem"> <a href="https://pub.dev/documentation/web/latest/" target="_blank"> package:web <span class="material-symbols-outlined">open_in_new</span> </a> </li> <li class="section-subitem"><a href="../dart-js_interop/dart-js_interop-library.html">dart:js_interop</a></li> <li class="section-subitem"><a href="../dart-js_interop_unsafe/dart-js_interop_unsafe-library.html">dart:js_interop_unsafe</a></li> <li class="section-subtitle">Web (Legacy)</li> <li class="section-subitem"> <a href="https://pub.dev/documentation/js/latest/" target="_blank"> package:js <span class="material-symbols-outlined">open_in_new</span> </a> </li> <li class="section-subitem"><a href="../dart-html/dart-html-library.html">dart:html</a></li> <li class="section-subitem"><a href="../dart-indexed_db/dart-indexed_db-library.html">dart:indexed_db</a></li> <li class="section-subitem"><a href="../dart-js/dart-js-library.html">dart:js</a></li> <li class="section-subitem"><a href="../dart-js_util/dart-js_util-library.html">dart:js_util</a></li> <li class="section-subitem"><a href="../dart-svg/dart-svg-library.html">dart:svg</a></li> <li class="section-subitem"><a href="../dart-web_audio/dart-web_audio-library.html">dart:web_audio</a></li> <li class="section-subitem"><a href="../dart-web_gl/dart-web_gl-library.html">dart:web_gl</a></li> </ol> </div> <div id="dartdoc-sidebar-right" class="sidebar sidebar-offcanvas-right"> <h5>dart:js_util library</h5> </div><!--/sidebar-offcanvas-right--> </main> <footer> <span class="no-break"> Dart 3.5.4 </span> <span class="glue-footer"> <span class="no-break"> | <a href="https://dart.dev/terms" title="Terms of use">Terms</a> </span> <span class="no-break"> | <a href="https://policies.google.com/privacy" target="_blank" rel="noopener" title="Privacy policy" class="no-automatic-external">Privacy</a> </span> <span class="no-break"> | <a href="https://dart.dev/security" title="Security philosophy and practices">Security</a> </span> <div class="copyright" style="font-size: 0.9em; color: darkgrey; margin-top: 0.5em;"> Except as otherwise noted, this site is licensed under a <a style="color: darkgrey;" href="https://creativecommons.org/licenses/by/4.0/"> Creative Commons Attribution 4.0 International License</a> and code samples are licensed under the <a style="color: darkgrey;" href="https://opensource.org/licenses/BSD-3-Clause" class="no-automatic-external"> 3-Clause BSD License</a> </div> </span> </footer> <script src="../static-assets/highlight.pack.js?v1"></script> <script src="../static-assets/docs.dart.js"></script> <button aria-hidden="true" class="glue-footer__link glue-cookie-notification-bar-control"> Cookies management controls </button> <script src="https://www.gstatic.com/glue/cookienotificationbar/cookienotificationbar.min.js" data-glue-cookie-notification-bar-category="2B"> </script> </body> </html>