popSingle method Null safety

void popSingle(
  1. BuildContext context,
  2. {bool rootNavigator = false,
  3. Object? result}
)

Implementation

static void popSingle(
  BuildContext context, {
  bool rootNavigator = false,
  Object? result,
}) {
  final nested = Provided.find<NestedNavigatorContainer>(context);
  if (nested?.navigatorKey != null) {
    nested!.navigatorKey?.currentState?.pop(result);
  } else {
    return Navigator.of(context, rootNavigator: rootNavigator).pop(result);
  }
}