bool isRouteActive(Instruction instruction)

Given an instruction, returns true if the instruction is currently active, otherwise false.

Source

bool isRouteActive(Instruction instruction) {
  Router router = this;
  if (currentInstruction == null) {
    return false;
  }
  // `instruction` corresponds to the root router
  while (router.parent != null && instruction.child != null) {
    router = router.parent;
    instruction = instruction.child;
  }
  if (instruction.component == null ||
      currentInstruction.component == null ||
      currentInstruction.component.routeName !=
          instruction.component.routeName) {
    return false;
  }
  var paramEquals = true;
  if (this.currentInstruction.component.params != null) {
    instruction.component.params.forEach((key, value) {
      if (!identical(this.currentInstruction.component.params[key], value)) {
        paramEquals = false;
      }
    });
  }
  return paramEquals;
}