'Get navigation is not functioning properly
I tried building flutter project with sound null safety and I am using get: ^4.6.1. Previously, without enabling null safety, navigation using Get was working fine, but now, navigation is not functioning properly. Initially, I got error
Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 4028 pos 12: '!_debugLocked': is not true.
which was resolved by using addPostFrameCallback. However, Whenever I try to navigate to new screen by tapping "See All", print statement gets executed, but it won't navigate to new screen unless I tap or drag somewhere else in screen.
GestureDetector(
onTap: () {
print("tapped");
WidgetsBinding.instance.addPostFrameCallback(
(_) => Get.toNamed(AllProductsScreen.route));
},
child: const Text(
"See All",
style: kHeaderTextStyle,
),
)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
