Flutter Navigator 2.0

Nov 8 2022 · Dart 2.17.3, Flutter 3.0.2, Android Studio 2020.3

Part 2: Deep Dive Into Navigator 2.0

04. Create an App State Manager

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 03. What are we Going to Build Next episode: 05. Create App State Notifier Functions

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

Before we move on, adding the Navigator 2.0 to our app, we need to add some files. Let us get started. Create a new directory in our lib folder named router. This directory will hold all the classes and files that we will create in our project. Create a new file as book_pages.dart This will have a list of unique keys for each page. This will help us when we will call the unique key while navigating from one page to another. (silence) (silence) To add few of the plugins that we will be needing throughout our project, navigate to your pubspec.yaml file and add the latest version of the following plugins. We will be using provider to manage the state of our application and url_strategy to compile our app with the web URL. Once adding the plugins make sure you run flutter pub get in your terminal. This command helps us to get the plugins in our project. Divergence may be different, but as far as they're above the current version, you should be fine to go ahead. In our routes folder, create a new dart file named app_state_manager.dart In this file we will create a manager that will manage the state of our application throughout the app. Create an AppStateManager class that extends change notifier so that our AppStateManager notifies the router for the change. Let us define few of the Boolean variables with false value that will hold the app states which we feel our app will be having. We can always add extra app states on later. (silence) (silence) Creating the get (indistinct) methods of the private variables that we have defined so that this can be accessible from the outside of our classes. (silence) (silence) (silence) These are few of the app states which we feel will be used by our application.