Movatterモバイル変換


[0]ホーム

URL:


menu
  1. Dart
  2. dart:js_util
dart:js_util
description

dart:js_util library

Utility methods to manipulatepackage:js annotated JavaScript interopobjects in cases where the name to call is not known at runtime.

Note

You should usually usedart:js_interop instead of this library.To learn more, check out theJS interop documentation.

You should only use these methods when the same effect cannot be achievedwith@JS() annotations.

Properties

globalThisObject
no setter
objectPrototypeObject?
Returns theObject prototype. Equivalent toObject.prototype.
no setter

Functions

add<T>(Object?first,Object?second)→ T
Perform JavaScript addition (+) on two values.
allowInterop<F extendsFunction>(Ff)→ F
Returns a wrapper around functionf that can be called from JavaScriptusingpackage:js JavaScript interop.
allowInteropCaptureThis(Functionf)Function
Returns a wrapper around functionf that can be called from JavaScriptusingpackage:js JavaScript interop, passing JavaScriptthis as thefirst argument.
and<T>(Object?first,Object?second)→ T
Perform JavaScript logical and comparison (&&) of two expressions.
callConstructor<T>(Objectconstr,List<Object?>?arguments)→ T
callMethod<T>(Objecto,Objectmethod,List<Object?>args)→ T
createDartExport<T extendsObject>(TdartObject)Object
Given a Dart object that is marked exportable, creates a JS object literalthat forwards to that Dart class. Look at the@JSExport annotation todetermine what constitutes "exportable" for a Dart class. The object literalwill be a map of export names (which are either the written instance membernames or their rename) to their respective Dart instance members.
createStaticInteropMock<T extendsObject,U extendsObject>(UdartMock, [Object?proto =null])→ T
Given a@staticInterop type T and an instancedartMock of a Dart classU that implements the external extension members of T, creates a forwardingmock.
dartify(Object?o)Object?
Effectively the inverse ofjsify,dartify Takes a JavaScript object, andconverts it to a Dart based object. Only JS primitives, arrays, or 'map'like JS objects are supported.
delete<T>(Objecto,Objectproperty)bool
Perform JavaScript delete operator (delete) on the given property of thegiven object.
divide<T>(Object?first,Object?second)→ T
Perform JavaScript division (/) on two values.
equal<T>(Object?first,Object?second)bool
Perform JavaScript equality comparison (==) on two values.
exponentiate<T>(Object?first,Object?second)→ T
Perform JavaScript exponentiation (**) on two values.
getProperty<T>(Objecto,Objectname)→ T
greaterThan<T>(Object?first,Object?second)bool
Perform JavaScript greater than comparison (>) of two values.
greaterThanOrEqual<T>(Object?first,Object?second)bool
Perform JavaScript greater than or equal comparison (>=) of two values.
hasProperty(Objecto,Objectname)bool
instanceof(Object?o,Objecttype)bool
Check whethero is an instance oftype.
instanceOfString(Object?element,StringobjectType)bool
Likeinstanceof only takes aString for the object name instead of aconstructor object.
isJavaScriptArray(dynamicvalue)bool
Returnstrue if a given object is a JavaScript array.
isJavaScriptSimpleObject(dynamicvalue)bool
Returnstrue if a given object is a simple JavaScript object.
isTruthy<T>(Object?o)bool
Determines if the given object is truthy or falsy.
jsify(Object?object)→ dynamic
Recursively converts a JSON-like collection to JavaScript compatiblerepresentation.
lessThan<T>(Object?first,Object?second)bool
Perform JavaScript less than comparison (<) of two values.
lessThanOrEqual<T>(Object?first,Object?second)bool
Perform JavaScript less than or equal comparison (<=) of two values.
modulo<T>(Object?first,Object?second)→ T
Perform JavaScript remainder (%) on two values.
multiply<T>(Object?first,Object?second)→ T
Perform JavaScript multiplication (*) on two values.
newObject<T>()→ T
not<T>(Object?o)→ T
Perform JavaScript logical not (!) on the given object.
notEqual<T>(Object?first,Object?second)bool
Perform JavaScript inequality comparison (!=) on two values.
objectGetPrototypeOf(Object?object)Object?
Returns the prototype of a given object. Equivalent toObject.getPrototypeOf.
objectKeys(Object?object)List<Object?>
Returns the keys for a given object. Equivalent toObject.keys(object).
or<T>(Object?first,Object?second)→ T
Perform JavaScript logical or comparison (||) of two expressions.
promiseToFuture<T>(ObjectjsPromise)Future<T>
Converts a JavaScript Promise to a DartFuture.
setProperty<T>(Objecto,Objectname,T?value)→ T
strictEqual<T>(Object?first,Object?second)bool
Perform JavaScript strict equality comparison (===) on two values.
strictNotEqual<T>(Object?first,Object?second)bool
Perform JavaScript strict inequality comparison (!==) on two values.
subtract<T>(Object?first,Object?second)→ T
Perform JavaScript subtraction (-) on two values.
typeofEquals<T>(Object?o,Stringtype)bool
Perform JavaScripttypeof operator on the given object and determine ifthe result is equal to the given type. Exposes the wholetypeof equalexpression to maximize browser optimization.
unsignedRightShift(Object?leftOperand,Object?rightOperand)num
Perform JavaScript unsigned right shift operator (>>>) on the given leftoperand by the amount specified by the given right operand.

Exceptions / Errors

NullRejectionException
Exception for when aJSPromise that is converted viaJSPromiseToFuture.toDart is rejected with anull orundefined value.
  1. Dart
  2. dart:js_util
DartSDK
  1. Libraries
  2. Core
  3. dart:async
  4. dart:collection
  5. dart:convert
  6. dart:core
  7. dart:developer
  8. dart:math
  9. dart:typed_data
  10. VM
  11. dart:ffi
  12. dart:io
  13. dart:isolate
  14. dart:mirrors
  15. Web
  16. package:webopen_in_new
  17. dart:js_interop
  18. dart:js_interop_unsafe
  19. Web (Legacy)
  20. dart:html
  21. dart:indexed_db
  22. dart:js
  23. dart:js_util
  24. dart:svg
  25. dart:web_audio
  26. dart:web_gl
dart:js_util library

[8]ページ先頭

©2009-2025 Movatter.jp