maybePop<T> method

Future<bool> maybePop<T>([
  1. T? result
])

Pop the top-most route if possible

See Navigator.maybePop

Implementation

Future<bool> maybePop<T>([T? result]) async {
  try {
    final context = _currentContext;
    if (context == null) {
      if (_enableLogger) {
        debugPrint('NavService.maybePop: No valid context found.');
      }
      return false;
    }
    return await Navigator.of(context).maybePop<T>(result);
    // ignore: avoid_catches_without_on_clauses
  } catch (e, st) {
    if (_enableLogger) {
      debugPrint('NavService.maybePop.exception: $e\n$st');
    }
    return false;
  }
}