# Dart Support in Maguyva: Code Graphs for Flutter and Dart Apps

Canonical source: https://maguyva.ai/languages/dart

License: text under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/); code samples under [MIT-0](https://opensource.org/license/mit-0); the Maguyva name, logos, brand assets and other code are not covered. Details: [maguyva.ai/license](https://maguyva.ai/license).

Maguyva parses Dart with AST, symbol, and graph support, so AI agents can follow classes, mixins, extensions, and constructors across Flutter and Dart code.

## Support snapshot

- Tier: AST and symbol support
- Programming
- Extensions: .dart
- Real AST parsing for syntax-aware search and structural context.
- Named symbols feed semantic lookup and cross-reference. Graph navigation is available when relationship extraction is enabled.
- This language contributes symbols and relationships to graph-aware search; supported edge types vary with its native constructs.
- AST parsing and symbol extraction are both available.

## Best fit

- Flutter apps where widgets, state classes, repositories, and services call each other across many files.
- Dart packages that use mixins and extension methods to add behaviour to types defined elsewhere.
- Server-side and command-line Dart that shares models with a Flutter client.

## Agent workflows

- Find every caller of a repository or service method before changing its API.
- List which classes implement an interface before adding a member to it.
- Trace how a tap in a widget reaches the network layer.

## Where Dart trips up shallow AI tools

Dart spreads one type across several constructs. A class can extend one base, implement several interfaces, and mix in behaviour `with` mixins. Extension methods attach members to types defined elsewhere, and named and `factory` constructors hide which class actually gets built. Text search finds the names but not the structure behind them.

Maguyva gives an agent that structure, so it can follow a change from a widget to the service it depends on.

## What Maguyva extracts in Dart

Maguyva covers `.dart` files. Classes, mixins, and extensions are extracted as types. The `functions` preset in `structural_search` covers functions, methods, local functions, lambdas, and generative, `const`, and `factory` constructors. Signatures record optional positional and named parameter groups and `static` members, and definition names drop trailing `?` and `!`.

Imports normalise `import`, `part`, and `library` directives and drop their `show`, `hide`, and `as` clauses. A call through an import prefix, such as `http.get` after `import 'package:http/http.dart' as http`, stays in the graph.

Receiver typing follows parameters, typed and initialised variables, getters, and `for`-`in` loops over lists, sets, and iterables, and treats `var` and `dynamic` as inferred. `extends`, `implements`, and `with` clauses are followed when resolving inherited members. The graph also records instantiation, type references, reads and writes, and exception edges.

## Example agent prompts

- "Who calls `CartRepository.addItem`, and from which widgets?" (`find_symbol`, then `dependency_search` incoming)
- "Which classes implement `PaymentGateway`?" (`dependency_search`)
- "Trace how the checkout button reaches the payments API." (`get_task_context`)

## Known limits

- About 200 Dart core-library names are filtered from relationships, including collection helpers such as `map`, `where`, and `forEach`, `Future` and `Stream` methods such as `then` and `listen`, and the `dart:` libraries. Use `text_pattern_search` for them.
- Dart signature nodes keep the body as a sibling, so in `structural_search` results a local function or lambda can overlap the callable that contains it, and getters and setters appear as method signatures.

## Next steps

Connect a repository with the [quickstart](/docs/quickstart), then check the support matrix on the [compatibility page](/docs/compatibility). For other mobile codebases, read the [Kotlin guide](/languages/kotlin) and the [Swift guide](/languages/swift).

## Engine details

- Dart support covers `.dart`. Classes, mixins, and extensions are types, and constructors include generative, `const`, and `factory` forms.
- Imports normalise `import`, `part`, and `library` directives, and calls through an import prefix stay in the graph.
- Receiver typing follows parameters, variables, getters, and `for`-`in` loops, and about 200 core-library names are filtered from relationships.

## Useful MCP entry points

- `find_symbol`: Use it for a widget, repository, or service class when you need the definition and references.
- `dependency_search`: Use incoming traversal on a repository method or interface to see callers and implementers before an API change.
- `get_task_context`: Use it for prompts like “trace how the checkout button reaches the payments API.”
