Workiva / react-dart

Dart Bindings for React JS
BSD 2-Clause "Simplified" License
412 stars 67 forks source link

`generateJsProps` should use `jsify(dartMap)` #392

Open ryanheise opened 5 months ago

ryanheise commented 5 months ago

I've found that generateJsProps will produce an incorrect JsMap when one of the values in the Map is a JS constructor (a JavaScriptFunction in the Dart type system). However, jsify() produces the correct conversion. The following changes fix it:

class JsBackedMap extends MapBase<dynamic, dynamic> {
  JsBackedMap() : jsObject = js_util.jsify({});
  factory JsBackedMap.from(Map other) => JsBackedMap.backedBy(js_util.jsify(other));
  ...
}