openRawDataInNewWindow method

Future<void> openRawDataInNewWindow({
  1. required Map<String, dynamic> data,
  2. String title = 'Body',
  3. bool beautificationRequired = true,
})

Opens raw / JSON map data in a new desktop window (headers, etc.).

Implementation

Future<void> openRawDataInNewWindow({
  required Map<String, dynamic> data,
  String title = 'Body',
  bool beautificationRequired = true,
}) async {
  if (kIsWeb || !InfospectUtil.isDesktop) return;

  final bool darkTheme = _infospect.context != null ? isDarkTheme : true;

  await openWindow(
    (context, id) => mobileRoutes.rawDataViewer(
      data: data,
      beautificationRequired: beautificationRequired,
      title: title,
      standaloneWindow: true,
    ),
    options: WindowOptions(
      title: title,
      size: const Size(900, 700),
      minimumSize: const Size(480, 360),
      alignment: Alignment.center,
      shellOverrides: ViewShellOverrides(
        appearance: AppShellPatch(
          theme: InfospectTheme.lightTheme,
          darkTheme: InfospectTheme.darkTheme,
          themeMode: darkTheme ? ThemeMode.dark : ThemeMode.light,
        ),
      ),
    ),
  );
}