How to restrict device orientation in Flutter

Jon Delgado
1 min readMay 8, 2018

--

Say you’re trying to build a Snapchat-like application, like this:

Ideally you’d want to “lock” the device orientation and not allow it to change as the user rotates their phone; and this was surprisingly tricky (and easy) to set.

SystemChrome.setPreferredOrientations returns a Future . We want to wait until that’s done and then (pun intended) we can start our app.

Thanks for reading.

--

--