1
votes

Original javascript code I like to port to Dart.

hterm.defaultStorage = new lib.Storage.Chrome(chrome.storage.sync);

I have tried

js.context['hterm']['defaultStorage'] = 
    new js.JsObject(js.context['lib']['Storage']['Chrome'], js.context['chrome']['storage']['sync']);

but this doest work as I expected. perhaps, because js.JsObject returns dart object. Do I have to use JsObject.jsify ? it seems that jsify receive collection of dart object only.

1
Hm. I'm just going to extract pure javascript code to separate file. and call it from dart. - Sungguk Lim

1 Answers

2
votes

I think it should work this way

js.context['hterm']['defaultStorage'] = 
    js.context['lib']['Storage'].callMethod('Chrome', [js.context['chrome']['storage']['sync']]);