flutter-cupertino-store icon indicating copy to clipboard operation
flutter-cupertino-store copied to clipboard

ensureInitialized() missing before setPreferredOrientations()

Open maganap opened this issue 5 years ago • 1 comments

@Flutter 1.12.13+hotfix.5 From: https://codelabs.developers.google.com/codelabs/flutter-cupertino/#2

On the first run of this lab, an error shows up when calling setPreferredOrientations() in main() because WidgetsFlutterBinding.ensureInitialized(); needs to be called first.

That line of code is missing from the codelab. Adding it solves the issue.

Screenshot 2019-12-28 at 20 05 26

maganap avatar Dec 28 '19 19:12 maganap

this fixed the issue for me, too.

the codelab code sample here should be updated, too: https://codelabs.developers.google.com/codelabs/flutter-cupertino/#2

stevenyix avatar Dec 30 '19 07:12 stevenyix