showCustomDialog<T> method

Future<T?> showCustomDialog<T>({
  1. required Widget dialog,
  2. bool barrierDismissible = true,
})

Shows a dialog using the stored navigator key

Implementation

Future<T?> showCustomDialog<T>({
  required Widget dialog,
  bool barrierDismissible = true,
}) async {
  // Add safety check
  if (_config.navigatorKey.currentContext == null) {
    log(
      'Cannot show dialog: No valid context available',
      name: "Flutter Dino",
    );
    return null;
  }

  // Check if dialog is already showing
  if (_config.navigatorKey.currentState?.canPop() ?? false) {
    return null;
  }
  return showDialog<T>(
    context: _config.navigatorKey.currentContext!,
    barrierDismissible: barrierDismissible,
    builder: (context) => dialog,
  );
}