Showing dialog from inside another dialog

1.3k Views Asked by At

How do you show a dialog from an already open dialog? Basically, nesting dialogs in Flutter.

When I try to use showDialog(); in Flutter from inside an already created dialog(for example, by clicking some link inside a dialog, another dialog should open on top of that dialog) I get the following lint error:

Flutter showDialog Lint Error

Does any one have any idea on how to solve this problem?

1

There are 1 best solutions below

2
On BEST ANSWER

Nesting dialogs is VERY possible. You are facing an entirely different issue.

Right now, you have conflicting imports from the custom_alert_dialog package, and the material.dart.

To resolve the issue, you have to name one of the imports using the as keyword.

E.x

import 'dart:math' as math;

Then to use it:

// BEFORE 
final valueOfPi = pi;

// AFTER
final valueOfPi = math.pi

The syntax of everything remains the same, but whenever you want to use an object or type from the library, just add the keyword as a prefix.