# Routing

{% hint style="info" %}
Are you frustrated about using **BuildContext** everytime when you navigate? Here comes the solution.&#x20;
{% endhint %}

**Pulse-X's** navigation service relies on **BuildContext** but you won't have to use context everytime when you navigates to a screen or pops back to the original screen.

🚧 Pulse-X's navigator is still under implementation stage and only three functions have been implemented.

* push
* pushNamed
* pop

But, first you'll have to do a few things in order to get contextless navigation.

#### Step 1:

Register Pulse-X's navigator key in your `MaterialApp` like this.

```dart
// ...your code...
MaterialApp(
    // other stuff
    navigatorKey: PulseXNavigator.navigatorKey,// register pulse's navigator key
);
// ...your code...
```

#### Step 2:

Register Pulse-X's navigation service in your dependency injection section like this.

```dart
PulseXInjector injector = PulseXInjector.instance;
injector.registerLazySingleton(() => PulseXNavigator());
```

#### Final Step:&#x20;

Now, you can use Pulse-X's navigation service easily.&#x20;

```dart
final _navigator = injector.find<PulseXNavigator>();
```

You can `await` return values from another screen.

```dart
final data = await _navigator.push(AnotherView());
              if(data != null){
                // do something
              }
```

For push method,

```dart
_navigator.push(AnotherView();
```

For pushNamed method,

🚧 still coding and testing, I'll let you know when it's ready

For pop method,

```dart
 _navigator.pop();
```

You can return arguments from pop method like this.

```dart
 _navigator.pop<String>("return value");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ye-lwin-oo-1.gitbook.io/pulse-x-state-management/route-management/routing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
