W3cubDocs

/Dart 2

hasProperty method

bool hasProperty (dynamic property)

Returns true if the JavaScript object contains the specified property either directly or though its prototype chain.

This is the equivalent of the in operator in JavaScript.

Implementation

bool hasProperty(property) {
  if (property is! String && property is! num) {
    throw new ArgumentError("property is not a String or num");
  }
  return JS('bool', '# in #', property, _jsObject);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-js/JsObject/hasProperty.html