bool isChecked = false;
void isValidate() {
if (_formKey.currentState != null) {
if (_formKey.currentState!.validate()) {
print("is valid");
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (context) => AnaSayfaView(),
),
(route) => false);
} else {
print("is not valid");
}
}
}
I have this code. The error message says:
A page-based route cannot be completed using imperative api, provide a new list without the corresponding Page to Navigator.pages instead.'package:flutter/src/widgets/navigator.dart':navigator.dart:1Failed assertion: line 3040 pos 7: '!pageBased || isWaitingForExitingDecision'
I have tried to navigate another page and not turning back to same page again.