Flutter Navigator 2.0

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

Part 4: Deep Links & Web Urls

20. Create a Navigation State Object

Episode complete

Play next episode

Save for later
About this episode
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 19. Setup Deep Links Next episode: 21. Create a Route Information Parser

This video Create a Navigation State Object was last updated on Nov 8 2022

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

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a kodeco.com Professional subscription.

Episode - 20 Create a Navigation State Object

Let us start by creating a Navigation State Object that will hold the state of the navigation. Currently we have an App State Manager that manages the state of the app, but nothing to manage the state of the navigation.

location = Uri.decodeFull(location ?? ''); 
final uri = Uri.parse(location); 
final params = uri.queryParameters;
final itemId = params[AppLink.idParam]; 
final link AppLink(
	location: uri.path,
	itemId: itemId

return link;

case loginPath: 
	return loginPath;
case itemPath:
var loc = '$itemPath?';
	String addKeyValuePair({required String key, String? value}){
		value == null ? '${key}=$value';
	loc += addKeyValuePair(key: idParam, value: itemId);
	return Uri.encodeFull(loc);