0

I would like to use JS interop to expose a set of functions/objects coded in dart.

I know how to use js-interop to share variables with JS scripts. But I have a requirement : I can't edit dart classes as they are coming from an external library without JS dependency.

And while I know it's possible to do something like :

@anonymous
@JS()
class Config {
    external bool get value;

    external factory Config({bool value});

    factory Config.fromExternalLib(ExternalConfig config) {
        return new Config(value: config.value);
    }
}

I'd like to avoid that, as it requires to duplicate every classes.

Is there any way to convert any dart object to JS object without modifying or forking the class ?

Rémi Rousselet
  • 256,336
  • 79
  • 519
  • 432

0 Answers0