“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
Apps With Multiple Pages
PAGE 1 PAGE 2
2.
Day 3
Navigation inFlutter Apps
“Flutter and the related logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
3.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
Imperative vs Declarative Navigation
Imperative:
● How: You tell Flutter what to do step-by-step to navigate (e.g., Navigator.push(), Navigator.pop()).
● Control: Offers fine-grained control over the navigation flow.
● Complexity: Can become complex to manage state, especially with deep linking or complex scenarios.
Declarative:
● How: You describe the desired state of the UI's navigation (e.g., using GoRouter's routes configuration).
● State-Driven: Navigation is a result of changes in your application's state.
● Simplicity: Often leads to cleaner and more maintainable code for complex navigation.
4.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
The Stack
Stack of Books
Stack of Cards
5.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
The Navigation Stack
Root / FirstPage
Second Page
Third Page
Fourth Page
Navigator.push(Second Page)
Navigator.push(Third Page)
Navigator.push(Fourth Page)
Navigator.pop
Navigator.pop
Navigator.pop
Navigator.pop ??
App Kidar Hei?
6.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
Example
7.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
Named Routes
Instead of directly providing the MaterialPageRoute (or similar route objects) every time you navigate, you define routes with
unique string identifiers (names) in your MaterialApp.
● Improved Readability
● Centralized Route Management
● Easier Parameter Passing
● Decoupling
8.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
Example
9.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
It’s Coding Time
10.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
What Next ?
1. Build More UI
2. Forms and Validation
3. Learn to make network calls GET, POST, PATCH, DELETE, PUT ( http/dio package )
4. Learn One State Management Solutions ( Provider, Bloc, Stacked, Riverpod, GetX )
5. Complex, Responsive UI and Animations
6. Future and Streams
7. Remote Databases ( Appwrite , Firebase )
8. Use of Native Plugins( location, shared_preferences, sensors, map )
9. Debugging Flutter Apps
10. Releasing and Publishing App on Play Store and App Store
And many more……..
11.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
Resources
1. Flutter Official Documentation: https://docs.flutter.dev/
2. Widget Index: https://docs.flutter.dev/reference/widgets
3. Codelabs: https://docs.flutter.dev/codelabs
4. Youtube Channels: Flutter, Reso Coder, Flutterly, Codepur, Tadas Petra, React Bits
5. Flutter Community ( Global ):
→ https://flutter.dev/community
6. Flutter Kathmandu Meetup Group:
a. Twitter: https://twitter.com/i/communities/1505161922848890882
b. Meetup: https://meetup.com/flutter-kathmandu/
7. Open Source Projects
12.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
13.
“Flutter and therelated logo are trademarks of Google LLC. Dart Community KU’s events are not affiliated with or otherwise sponsored by Google LLC.”
Thank you!
Flutter Kathmandu Meetup Group
🙏