i have the following pages in my app
- landing
- login
- Registration
- bottom_navigation_page
- contact_us
I'm using beamer 0.14.1 for navigation
the landing page has a 'Contact Us' button that should open the contact_us page, and in the bottom navigation (in the more tab) there is a 'Contact Us' button, currently my beamer navigation looks like this
class StartingLocation extends BeamLocation {
@override
List<String> get pathBlueprints => ['/'];
@override
List<BeamPage> buildPages(BuildContext context, BeamState state) => [
BeamPage(
key: ValueKey('landing'),
child: LandingPage(),
),
];
}
class LandingLocation extends BeamLocation {
@override
List<String> get pathBlueprints => [
'/login'
'/registration'
'/contactUs',
];
@override
List<BeamPage> buildPages(BuildContext context, BeamState state) => [
...StartingLocation().buildPages(context, state),
if (state.uri.pathSegments.contains('login'))
BeamPage(
key: ValueKey('login'),
child: LoginPage(),
),
if (state.uri.pathSegments.contains('registration'))
BeamPage(
key: ValueKey('registration'),
child: RegistrationPage(),
),
if (state.uri.pathSegments.contains('contactUs'))
BeamPage(
key: ValueKey('contactUs'),
child: ContactUsPage(),
),
];
}
class NavigationLocation extends BeamLocation {
@override
List<String> get pathBlueprints => [
'/navigation',
'/navigation/notifications',
'/navigation/profile',
];
@override
List<BeamPage> buildPages(BuildContext context, BeamState state) => [
...LandingLocation().buildPages(context, state),
if (state.uri.pathSegments.contains('navigation'))
BeamPage(
key: ValueKey('navigation'),
child: NavigationPage(),
),
if (state.uri.pathSegments.contains('notifications'))
BeamPage(
key: ValueKey('notifications'),
child: NotificationsPage(),
),
if (state.uri.pathSegments.contains('profile'))
BeamPage(
key: ValueKey('profile'),
child: ProfilePage(),
),
];
}
in the landing page i use this code to open the contact us page onPressed: () => context.beamToNamed('/contactUs'), and it works fine, but when i use the same code in the more page it throws this error:
======== Exception caught by widgets library =======================================================
The following assertion was thrown building Builder:
'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3619 pos 18: '!keyReservation.contains(key)': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
The relevant error-causing widget was:
MaterialApp file:///Users/username/FlutterProjects/project_name/lib/main.dart:88:28
When the exception was thrown, this was the stack:
#2 NavigatorState._debugCheckDuplicatedPageKeys.<anonymous closure> (package:flutter/src/widgets/navigator.dart:3619:18)
#3 NavigatorState._debugCheckDuplicatedPageKeys (package:flutter/src/widgets/navigator.dart:3624:6)
#4 NavigatorState._updatePages.<anonymous closure> (package:flutter/src/widgets/navigator.dart:3659:7)
#5 NavigatorState._updatePages (package:flutter/src/widgets/navigator.dart:3662:6)
#6 NavigatorState.didUpdateWidget (package:flutter/src/widgets/navigator.dart:3606:7)
...
====================================================================================================