blob: d48d3afa05478f593085de66f5f794f6b33a5702 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'system_channels.dart';
/// Controls specific aspects of the system navigation stack.
class SystemNavigator {
SystemNavigator._();
/// Removes the topmost Flutter instance, presenting what was before
/// it.
///
/// On Android, removes this activity from the stack and returns to
/// the previous activity.
///
/// On iOS, calls `popViewControllerAnimated:` if the root view
/// controller is a `UINavigationController`, or
/// `dismissViewControllerAnimated:completion:` if the top view
/// controller is a `FlutterViewController`.
///
/// This method should be preferred over calling `dart:io`'s [exit]
/// method, as the latter may cause the underlying platform to act
/// as if the application had crashed.
static Future<void> pop() async {
await SystemChannels.platform.invokeMethod<void>('SystemNavigator.pop');
}
}