searchDelegate method
Function to search for a delegate by its route id.
Parameters:
k
: The route id to search for.
Returns: The delegate associated with the given route id.
Throws:
- If the provided route id is not found in the keys map.
Implementation
GetDelegate searchDelegate(String? k) {
GetDelegate key;
if (k == null) {
key = Get.rootController.rootDelegate;
} else {
if (!keys.containsKey(k)) {
throw 'Route id ($k) not found';
}
key = keys[k]!;
}
// if (_key.listenersLength == 0 && !testMode) {
// throw """You are trying to use contextless navigation without
// a GetMaterialApp or Get.key.
// If you are testing your app, you can use:
// [Get.testMode = true], or if you are running your app on
// a physical device or emulator, you must exchange your [MaterialApp]
// for a [GetMaterialApp].
// """;
// }
// Missing return statement for 'key' here in the original code
return key;
}