openWindow static method
Opens a new Window.
name
of the Window.html
the Window HTML.print
iftrue
will print the window.
Implementation
static JsObject openWindow({String? name, String? html, bool print = false}) {
var openParams = <dynamic>[];
if (name != null) {
if (openParams.isEmpty) {
openParams.add(null);
}
openParams.add(name);
}
var w = context.callMethod('open', openParams) as JsObject;
if (html != null && html.isNotEmpty) {
var doc = w['document'] as JsObject;
var body = doc['body'] as JsObject;
var o = context.callMethod(r'$', [body]) as JsObject;
o.callMethod('html', [html]);
}
if (print) {
w.callMethod('focus');
w.callMethod('print');
}
return w;
}