# Magic Deeplink

**Every link lands on the right screen.**

Universal Links on iOS and App Links on Android through one API on top of `app_links`. The driver also runs on macOS and is inert on web.

## One API. Every link.

A link can come from the OS, from a push notification or from your own code. Magic Deeplink sends each one through the same handler chain.

### One handler chain

`DeeplinkManager` runs a handler chain and the first match wins (`registerHandler`, `handleUri`). Each link arrives as a `DeeplinkSource`: `osLink`, `push` or `manual`.

[Learn more about One handler chain](https://anilcancakir.com/magic/docs/deeplink/architecture/deeplink-manager.md)

### Links to routes

`RouteDeeplinkHandler` maps link paths to app routes through `MagicRoute`, and a `TenantSwitchGate` guards tenant switches. `DeeplinkHandler` is the contract for your own.

[Learn more about Links to routes](https://anilcancakir.com/magic/docs/deeplink/basics/handlers.md)

### Push-tap routing

`OneSignalDeeplinkHandler` routes push-notification taps. It is wired automatically when the notifications service is bound (magic_notifications).

[Learn more about Push-tap routing](https://anilcancakir.com/magic/docs/deeplink/basics/handlers.md)

### Association files

`deeplink:generate` writes the Apple `apple-app-site-association` file and the Android `assetlinks.json` from your config.

[Learn more about Association files](https://anilcancakir.com/magic/docs/deeplink/basics/cli.md)

### Setup checks

`deeplink:doctor` checks your iOS and Android setup. Native project setup is still yours to do: iOS associated domains and an Android intent filter.

[Learn more about Setup checks](https://anilcancakir.com/magic/docs/deeplink/basics/cli.md)

### Driver and events

The `DeeplinkDriver` contract has `AppLinksDriver` as the default. `DeeplinkOpened` and `DeeplinkNavigating` events feed Magic's breadcrumbs.

[Learn more about Driver and events](https://anilcancakir.com/magic/docs/deeplink/basics/drivers.md)

## Add it in seconds

```bash
flutter pub add magic_deeplink
```

Or add to `pubspec.yaml`:

```yaml
dependencies:
  magic_deeplink: ^1.0.1
```

Or give your AI agent this prompt:

```text
Read https://anilcancakir.com/magic/docs/deeplink/llms.txt and install the Magic Deeplink package in this project.
```

## Docs

### Getting Started

- [Installation](https://anilcancakir.com/magic/docs/deeplink/getting-started/installation.md)
- [Configuration](https://anilcancakir.com/magic/docs/deeplink/getting-started/configuration.md)

### The Basics

- [Drivers](https://anilcancakir.com/magic/docs/deeplink/basics/drivers.md)
- [Handlers](https://anilcancakir.com/magic/docs/deeplink/basics/handlers.md)
- [CLI](https://anilcancakir.com/magic/docs/deeplink/basics/cli.md)

### Architecture

- [DeeplinkManager](https://anilcancakir.com/magic/docs/deeplink/architecture/deeplink-manager.md)
- [DeeplinkServiceProvider](https://anilcancakir.com/magic/docs/deeplink/architecture/service-provider.md)
