searchDelegate method

GetDelegate<T> searchDelegate(
  1. String? k
)

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<T> searchDelegate(String? k) {
  GetDelegate<T> key;
  if (k == null) {
    key = Get.rootController.rootDelegate as GetDelegate<T>;
  } else {
    if (!keys.containsKey(k)) {
      throw Exception("Route id ($k) not found");
    }
    key = keys[k]! as GetDelegate<T>;
  }

  // Missing return statement for 'key' here in the original code
  return key;
}