I work in flutter project, and i have a problem that : the project composed from three Pages (splash.dart, login.dart, dashboard.dart), when the app launch the splash.dart page opened, and i passe the new user to login.dart page, and when he put a valid credentials i passe he to dashboard.dart page but in this second passage i got the error below "[ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3499 pos 12: '!_debugLocked': is not true." Also when i want to display an alert to inform the user to put a valid credentials when he put invalid credentials a got the same problem thanks in advance,
1
votes
No, It is not the same problem, also it doesn't have a correct answer
- Wael Messaadi
how about this? github.com/flutter/flutter/issues/36177#issuecomment-650713430
- alecsam
@alecsam thanks its a correct response
- Wael Messaadi
hey @WaelMessaadi your problem is solved?
- Abhishek Ghaskata
@AbhishekGhaskata, yes it solved
- Wael Messaadi
1 Answers
0
votes
The method you use for page redirection should look like this:
Navigator.of(context).push(
MaterialPageRoute(
settings: RouteSettings(name: OtherPage.routeName),
builder: (context) => OtherPage(),
),
);
If this method doesn't fix your problem, be careful where you define it in the builder widget and make sure you don't use BuildContext in unnecessary places