show static method
Opens the DevTools dialog modal.
Implementation
static Future<void> show(
BuildContext context, {
GlobalKey<NavigatorState>? navigatorKey,
ThemeData? customTheme,
bool useRootNavigator = true,
}) async {
if (isOpen.value) return;
isOpen.value = true;
try {
final nav =
navigatorKey?.currentState ??
Navigator.maybeOf(context, rootNavigator: useRootNavigator) ??
Navigator.maybeOf(context, rootNavigator: !useRootNavigator) ??
_findAppNavigator();
if (nav == null) {
debugPrint(
'[DevToolsDialog] Could not find a Navigator to host the DevTools '
'dialog. Call show() from a context under a Navigator, or pass a '
'navigatorKey. Falling back to silent no-op.',
);
return;
}
await showDialog<void>(
context: nav.context,
useRootNavigator: useRootNavigator,
builder: (_) => DevToolsDialog(customTheme: customTheme),
);
} finally {
isOpen.value = false;
}
}