fml2js static method

void fml2js({
  1. String? version,
})

This is a stub for expansion, some kind of protocol should be decided on within the data field before proceeding further

Implementation

static void fml2js({String? version}) {
  version = version ?? '?';
  final data = <String, dynamic>{
    'data': 'FML v$version',
    'from': 'fml',
    'to': 'js'
  };
  const jsonEncoder = JsonEncoder();
  final json = jsonEncoder.convert(data);
  context.callMethod('postMessage', [json, '*']);
}