#StackBounty: #flutter #dart #flutter-web #dart-js-interop How to pass options to javascript function using dart:js?

Bounty: 50

I have the following functional javascript code to demonstrate what I want to achieve. It should output the object passed to the method, and then the value of the property "a".

<!DOCTYPE html>
    window.theObjectCall = function(x) {

I have the following dart code, and it works, but "a" is not accessible as I expect.

library whatever;

import 'dart:js';

import 'package:js/js.dart';

@JS('theObjectCall') // Accessing method getCurrentPosition from Geolocation API
external void theJsObjectCall(JsObject theObject);

void someJsCallWithObject() {
  var object = JsObject(context['Object']);
  object['a'] = 'xxx';

Executing the below logs "undefined" in the console.

enter image description here

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.