completeDialog method

void completeDialog({
  1. required BuildContext context,
  2. required String completerId,
  3. dynamic result,
  4. dynamic pop = true,
})

Completes the _dialogCompleter to resume the Future's execution call

Implementation

void completeDialog(
    {required BuildContext context,
    required String completerId,
    dynamic result,
    pop = true}) {
  if (_dialogCompleter.containsKey(completerId)) {
    if (pop) {
      try {
        Navigator.of(context, rootNavigator: true).pop();
      } catch (_) {}
    }
    _dialogCompleter[completerId]?.complete(result);
    _dialogCompleter.remove(completerId);
  }
}