Closed borutjures closed 2 years ago
Thanks for the thought, but we can already do what you're suggesting with jsutil.jsify()
. objectToMap()
exists explicitly to do this only at the top level.
Thank you for the clarification about the intent of objectToMap(). However it cannot be replaced with jsify - see table below. I’ll remove the change and create a dartify().
jsify: Dart => JS dartify: JS => Dart objectToMap: JS => Dart
I used dart-sass to learn and implement a Dart library used in Node.js. Thanks Dart Sass team!
I used
objectToMap()
(lib/src/node/utils.dart
) to convert JavaScript JSON objects but it only converts the first level. My JSON data uses more than one level ofMap<String, dynamic>
. (I use standard DartfromJson()
which expects the entire object to be converted into a map on every level)I changed the following line in
objectToMap()
to make a deep conversion to Map:Your implementation obviously works for how you use it. I just thought it might be useful to support any JSON.
Thank you for the best example for JavaScript code to call Dart code! (I'm still struggling with how to call Dart static methods from JavaScript)