internalCreateWindow method
Future<Window?>
internalCreateWindow(
- String? id,
- WindowConfig config, {
- bool start = false,
- Window? window,
- required MethodChannel channel,
- String name = "plugin.create_window",
Implementation
Future<Window?> internalCreateWindow(
String? id,
WindowConfig config, {
bool start = false, // start immediately if true
Window? window,
required MethodChannel channel,
String name = "plugin.create_window",
}) async {
// check permission first
if (!await checkPermission()) {
throw Exception("no permission to create window");
}
// store the window first
// window.id can't be updated
// for main engine use
// if (window != null) _windows[window.id] = window;
var updates = await channel.invokeMapMethod(name, {
"id": id,
"config": config.toMap(),
"start": start,
});
// if window is not created, new one
return updates == null ? null : (window ?? Window()).applyMap(updates);
}