toggleOrientation static method

void toggleOrientation()

Switches the system orientation.

Implementation

static void toggleOrientation() {
  if (available) {
    final binding = VirtualWidgetsFlutterBinding.virtualBinding;
    final orientation = binding.orientation;
    binding.orientation = (orientation == Orientation.portrait
        ? Orientation.landscape
        : Orientation.portrait);
  }
}